repo
stringclasses
856 values
pull_number
int64
3
127k
instance_id
stringlengths
12
58
issue_numbers
sequencelengths
1
5
base_commit
stringlengths
40
40
patch
stringlengths
67
1.54M
test_patch
stringlengths
0
107M
problem_statement
stringlengths
3
307k
hints_text
stringlengths
0
908k
created_at
timestamp[s]
ktbyers/netmiko
3,108
ktbyers__netmiko-3108
[ "3104" ]
e458edb49868c6b9a3b610937562e445d20f5126
diff --git a/netmiko/ssh_autodetect.py b/netmiko/ssh_autodetect.py --- a/netmiko/ssh_autodetect.py +++ b/netmiko/ssh_autodetect.py @@ -288,6 +288,12 @@ "priority": 99, "dispatch": "_autodetect_std", }, + "oneaccess_oneos": { + "cmd": "show version", + "search_patterns": [r"OneOS"], + "priority": 99, + "dispatch": "_autodetect_std", + }, } # Sort SSH_MAPPER_DICT such that the most common commands are first
SSHDetect - OneAccess device not detected Hi Kirk, The [SSHDetect](https://github.com/ktbyers/netmiko/blob/develop/netmiko/ssh_autodetect.py#L309) class is not able to detect OneAccess equipment. This is due to missing entry in the SSH_MAPPER_DICT dictionnary. The following entry should make it: ``` "oneaccess_oneos": { "cmd": "show version", "search_patterns": [r"OneOS"], "priority": 99, "dispatch": "_autodetect_std", }, ``` Do you mind if I send a pull request for this ?
@bilalel Sounds good. Yes, send a PR on it.
2023-02-08T20:35:50
ktbyers/netmiko
3,215
ktbyers__netmiko-3215
[ "3125" ]
e07b787309bb872459b5b0bb2082342a6f213b6d
diff --git a/netmiko/tplink/tplink_jetstream.py b/netmiko/tplink/tplink_jetstream.py --- a/netmiko/tplink/tplink_jetstream.py +++ b/netmiko/tplink/tplink_jetstream.py @@ -21,15 +21,12 @@ def __init__(self, **kwargs: Any) -> None: return super().__init__(**kwargs) def session_preparation(self) -> None: - """ - Prepare the session after the connection has been established. - """ delay_factor = self.select_delay_factor(delay_factor=0) time.sleep(0.3 * delay_factor) - self.clear_buffer() self._test_channel_read(pattern=r"[>#]") self.set_base_prompt() self.enable() + self.set_base_prompt() self.disable_paging() # Clear the read buffer time.sleep(0.3 * self.global_delay_factor)
tplink "Pattern not detected: '[>#]' in output." in version 4.0.0 and above Hello! An error appears when connecting to tplink in version 4.0.0 and above, but in version 3.4.0 there is no error and the result is displayed **Code:** ``` device = { "device_type": "tplink_jetstream", "host": host, "username": param["ssh_user"], "password": param["ssh_pass"], } with ConnectHandler(**device) as ssh: ssh.enable() output_before = ssh.send_command("sh system-info") print(output_before) ``` **Error:** ``` Pattern not detected: '[>#]' in output. Things you might try to fix this: 1. Adjust the regex pattern to better identify the terminating string. Note, in many situations the pattern is automatically based on the network device's prompt. 2. Increase the read_timeout to a larger value. You can also look at the Netmiko session_log or debug log for more information. ``` **Debug:** ``` DEBUG:paramiko.transport:starting thread (client mode): 0x30757d50 DEBUG:paramiko.transport:Local version/idstring: SSH-2.0-paramiko_2.12.0 DEBUG:paramiko.transport:Remote version/idstring: SSH-1.99-IPSSH-6.6.0 INFO:paramiko.transport:Connected (version 1.99, client IPSSH-6.6.0) DEBUG:paramiko.transport:=== Key exchange possibilities === DEBUG:paramiko.transport:kex algos: diffie-hellman-group1-sha1 DEBUG:paramiko.transport:server key: ssh-dss DEBUG:paramiko.transport:client encrypt: aes128-cbc, aes192-cbc, aes256-cbc, blowfish-cbc, cast128-cbc, 3des-cbc DEBUG:paramiko.transport:server encrypt: aes128-cbc, aes192-cbc, aes256-cbc, blowfish-cbc, cast128-cbc, 3des-cbc DEBUG:paramiko.transport:client mac: hmac-sha1, hmac-sha1-96, hmac-md5, hmac-md5-96 DEBUG:paramiko.transport:server mac: hmac-sha1, hmac-sha1-96, hmac-md5, hmac-md5-96 DEBUG:paramiko.transport:client compress: none DEBUG:paramiko.transport:server compress: none DEBUG:paramiko.transport:client lang: <none> DEBUG:paramiko.transport:server lang: <none> DEBUG:paramiko.transport:kex follows: False DEBUG:paramiko.transport:=== Key exchange agreements === DEBUG:paramiko.transport:Kex: diffie-hellman-group1-sha1 DEBUG:paramiko.transport:HostKey: ssh-dss DEBUG:paramiko.transport:Cipher: aes128-cbc DEBUG:paramiko.transport:MAC: hmac-sha1 DEBUG:paramiko.transport:Compression: none DEBUG:paramiko.transport:=== End of kex handshake === DEBUG:paramiko.transport:kex engine KexGroup1 specified hash_algo <built-in function openssl_sha1> DEBUG:paramiko.transport:Switch to new keys ... DEBUG:paramiko.transport:Adding ssh-dss host key for 10.10.10.150: b'6e3ca009ab027terd8aa7e40d0516ef8' DEBUG:paramiko.transport:userauth is OK INFO:paramiko.transport:Authentication (password) successful! DEBUG:paramiko.transport:[chan 0] Max packet in: 32768 bytes DEBUG:paramiko.transport:[chan 0] Max packet out: 32768 bytes DEBUG:paramiko.transport:Secsh channel 0 opened. DEBUG:paramiko.transport:[chan 0] Sesch channel 0 request ok DEBUG:paramiko.transport:[chan 0] Sesch channel 0 request ok DEBUG:netmiko:write_channel: b'\r\n' DEBUG:netmiko:read_channel: tp3428-test> tp3428-test> DEBUG:netmiko:Clear buffer detects data in the channel DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: ... EBUG:netmiko:read_channel: DEBUG:netmiko:write_channel: b'\r\n' DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: tp3428-test> DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: .... DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: DEBUG:netmiko:write_channel: b'exit\r\n' ``` In version 3.4.0, the same code works without errors: ``` ThreadPoolExecutor-0_0 root INFO: ===> 18:53:05.075551 Connection: 10.10.10.150 System Description - JetStream 24-Port Gigabit L2+ Managed Switch with 4 10GE SFP+ Slots System Name - tp3428-test System Location - Hong Kong Contact Information - www.tp-link.com Hardware Version - TL-SG3428X 1.0 Bootloader Version - TP-LINK BOOTUTIL(v1.0.0) System Time - 2023-02-22 18:53:16 Running Time - 0 day - 5 hour - 20 min - 12 sec ```
Can you post the full exception stack trace so I can see where the error actually happens? Thanks for the answer. Here is the full exception stack trace: ``` (myenv) [user @ MBA test_netmiko]$ python netmiko_ssh.py Traceback (most recent call last): File "/Users/user/test_netmiko/netmiko_ssh.py", line 10, in <module> with ConnectHandler(**device) as ssh: ^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/user/test_netmiko/myenv/lib/python3.11/site-packages/netmiko/ssh_dispatcher.py", line 365, in ConnectHandler return ConnectionClass(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/user/test_netmiko/myenv/lib/python3.11/site-packages/netmiko/tplink/tplink_jetstream.py", line 149, in __init__ return super().__init__(**kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/user/test_netmiko/myenv/lib/python3.11/site-packages/netmiko/tplink/tplink_jetstream.py", line 21, in __init__ return super().__init__(**kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/user/test_netmiko/myenv/lib/python3.11/site-packages/netmiko/base_connection.py", line 439, in __init__ self._open() File "/Users/user/test_netmiko/myenv/lib/python3.11/site-packages/netmiko/base_connection.py", line 445, in _open self._try_session_preparation() File "/Users/user/test_netmiko/myenv/lib/python3.11/site-packages/netmiko/base_connection.py", line 904, in _try_session_preparation self.session_preparation() File "/Users/user/test_netmiko/myenv/lib/python3.11/site-packages/netmiko/tplink/tplink_jetstream.py", line 30, in session_preparation self._test_channel_read(pattern=r"[>#]") File "/Users/user/test_netmiko/myenv/lib/python3.11/site-packages/netmiko/base_connection.py", line 1144, in _test_channel_read return self.read_until_pattern(pattern=pattern, read_timeout=20) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/user/test_netmiko/myenv/lib/python3.11/site-packages/netmiko/base_connection.py", line 672, in read_until_pattern raise ReadTimeout(msg) netmiko.exceptions.ReadTimeout: Pattern not detected: '[>#]' in output. Things you might try to fix this: 1. Adjust the regex pattern to better identify the terminating string. Note, in many situations the pattern is automatically based on the network device's prompt. 2. Increase the read_timeout to a larger value. You can also look at the Netmiko session_log or debug log for more information. ``` Versions of installed packages: ``` (myenv) [user @ MBA test_netmiko]$ pip list Package Version ------------------ --------- netmiko 4.1.2 paramiko 3.1.0 ``` Sorry, didn't check the full stacktrace of the exception, on a quick glance - some problem in the `_test_channel_read` method of the `BaseConnection` class
2023-05-19T20:20:00
ktbyers/netmiko
3,313
ktbyers__netmiko-3313
[ "3307" ]
a7dc248c99e6ba07b942b33247c0c12ff3649b00
diff --git a/netmiko/base_connection.py b/netmiko/base_connection.py --- a/netmiko/base_connection.py +++ b/netmiko/base_connection.py @@ -267,7 +267,8 @@ def __init__( to select smallest of global and specific. Sets default global_delay_factor to .1 (default: True) - :param session_log: File path or BufferedIOBase subclass object to write the session log to. + :param session_log: File path, SessionLog object, or BufferedIOBase subclass object + to write the session log to. :param session_log_record_writes: The session log generally only records channel reads due to eliminate command duplication due to command echo. You can enable this if you @@ -366,6 +367,7 @@ def __init__( no_log["password"] = self.password if self.secret: no_log["secret"] = self.secret + # Always sanitize username and password log.addFilter(SecretsFilter(no_log=no_log)) # Netmiko will close the session_log if we open the file @@ -386,10 +388,13 @@ def __init__( no_log=no_log, record_writes=session_log_record_writes, ) + elif isinstance(session_log, SessionLog): + # SessionLog object + self.session_log = session_log else: raise ValueError( "session_log must be a path to a file, a file handle, " - "or a BufferedIOBase subclass." + "SessionLog object, or a BufferedIOBase subclass." ) # Default values @@ -667,7 +672,6 @@ def read_until_pattern( start_time = time.time() # if read_timeout == 0 or 0.0 keep reading indefinitely while (time.time() - start_time < read_timeout) or (not read_timeout): - output += self.read_channel() if re.search(pattern, output, flags=re_flags): @@ -1447,7 +1451,6 @@ def clear_buffer( return output def command_echo_read(self, cmd: str, read_timeout: float) -> str: - # Make sure you read until you detect the command echo (avoid getting out of sync) new_data = self.read_until_pattern( pattern=re.escape(cmd), read_timeout=read_timeout
diff --git a/tests/test_netmiko_session_log.py b/tests/test_netmiko_session_log.py --- a/tests/test_netmiko_session_log.py +++ b/tests/test_netmiko_session_log.py @@ -4,6 +4,7 @@ import io import logging from netmiko import ConnectHandler +from netmiko.session_log import SessionLog def calc_md5(file_name=None, contents=None): @@ -195,3 +196,48 @@ def test_session_log_bytesio(device_slog, commands, expected_responses): log_content = s_log.getvalue() session_log_md5 = calc_md5(contents=log_content) assert session_log_md5 == compare_log_md5 + + +def test_session_log_custom_secrets(device_slog): + """Verify session_log does not contain custom words.""" + # Dict of words that should be sanitized in session log + sanitize_secrets = { + "secret1": "admin_username", + "secret2": "snmp_auth_secret", + "secret3": "snmp_priv_secret", + "supersecret": "supersecret", + } + # Create custom session log + custom_log = SessionLog(file_name="SLOG/device_log.log", no_log=sanitize_secrets) + custom_log.open() + + # Pass in custom SessionLog obj to session_log attribute + device_slog["session_log"] = custom_log + + conn = ConnectHandler(**device_slog) + conn.session_log.write("\nTesting password and secret replacement\n") + conn.session_log.write( + "This is my first secret {}\n".format(sanitize_secrets["secret1"]) + ) + conn.session_log.write( + "This is my second secret {}\n".format(sanitize_secrets["secret2"]) + ) + conn.session_log.write( + "This is my third secret {}\n".format(sanitize_secrets["secret3"]) + ) + conn.session_log.write( + "This is my super secret {}\n".format(sanitize_secrets["supersecret"]) + ) + + # Retrieve the file name. + file_name = custom_log.file_name + with open(file_name, "r") as f: + session_log = f.read() + if sanitize_secrets.get("secret1") is not None: + assert sanitize_secrets["secret1"] not in session_log + if sanitize_secrets.get("secret2") is not None: + assert sanitize_secrets["secret2"] not in session_log + if sanitize_secrets.get("secret3") is not None: + assert sanitize_secrets["secret3"] not in session_log + if sanitize_secrets.get("supersecret") is not None: + assert sanitize_secrets["supersecret"] not in session_log
security: allow SessionLog object to be passed to session_log arg TL;DR: allow SessionLog object to be passed to session_log argument for BaseConnection Netmiko logs all channel communication to a file via its own SessionLog for each device interaction. While SessionLog filters the username and password out automatically, there may be a case where you want more words/phrases sanitized in the session log. Currently, you can only pass a string or BufferedIOBase subclass to the session_log argument, which doesn't allow you to edit the SessionLog no_log argument. The no_log argument allows you to pass in a dict with words that you want sanitized from the session log. By adding the ability to pass in a SessionLog object, a user can customize the no_log argument, which allows for an arbitrary number of words to be sanitized in the logs, not just the username and password.
2023-10-18T00:49:09
Mailu/Mailu
73
Mailu__Mailu-73
[ "71" ]
79adbbb76ca596106a2408af0acd3c724185d17f
diff --git a/admin/freeposte/admin/models.py b/admin/freeposte/admin/models.py --- a/admin/freeposte/admin/models.py +++ b/admin/freeposte/admin/models.py @@ -143,7 +143,7 @@ class User(Email): # Settings displayed_name = db.Column(db.String(160), nullable=False, default="") spam_enabled = db.Column(db.Boolean(), nullable=False, default=True) - spam_threshold = db.Column(db.Numeric(), nullable=False, default=10.0) + spam_threshold = db.Column(db.Numeric(), nullable=False, default=80.0) # Flask-login attributes is_authenticated = True diff --git a/admin/migrations/versions/27ae2f102682_.py b/admin/migrations/versions/27ae2f102682_.py new file mode 100644 --- /dev/null +++ b/admin/migrations/versions/27ae2f102682_.py @@ -0,0 +1,37 @@ +"""spam_threshold in percent + +Revision ID: 27ae2f102682 +Revises: dc8c25cf5b98 +Create Date: 2016-09-30 08:06:15.025190 + +""" + +# revision identifiers, used by Alembic. +revision = '27ae2f102682' +down_revision = 'dc8c25cf5b98' + +from alembic import op +import sqlalchemy as sa + +from freeposte.admin.models import User +from freeposte import db + +def upgrade(): + # spam_threshold is a X/15 based value, we're converting it to percent. + for user in User.query.all(): + user.spam_threshold = int(100. * float(user.spam_threshold or 0.) / 15.) + db.session.commit() + + # set default to 80% + with op.batch_alter_table('user') as batch: + batch.alter_column('spam_threshold', default=80.) + +def downgrade(): + # spam_threshold is a X/15 based value, we're converting it from percent. + for user in User.query.all(): + user.spam_threshold = int(15. * float(user.spam_threshold or 0.) / 100.) + db.session.commit() + + # set default to 10/15 + with op.batch_alter_table('user') as batch: + batch.alter_column('spam_threshold', default=10.)
spam not moved to junk folder Hi, I'm running the `latest` images as of yesterday (probably 79adbbb). I've enabled spam detection in the admin console, and spam is actually detected and marked by rspamd, headers are inserted like: ``` X-Spamd-Result: default: True [24.36 / 15.00] RBL_SPAMHAUS_XBL(4.00)[] RBL_SPAMHAUS_XBL_ANY(4.00)[] HFILTER_HOSTNAME_UNKNOWN(2.50)[] BAYES_SPAM(3.06)[92.67%] HFILTER_HELO_BAREIP(3.00)[] RBL_SORBS_RECENT(1.50)[] RBL_SPAMHAUS_CSS(2.00)[] RBL_MAILSPIKE_WORST(2.00)[] MIME_UNKNOWN(0.10)[application/x-rar-compressed] RBL_SORBS(0.00)[] R_SPF_NEUTRAL(0.00)[?all] ONCE_RECEIVED(0.10)[] RBL_UCEPROTECT_LEVEL1(1.00)[] MIME_HTML_ONLY(0.20)[] RBL_SEM(1.00)[] MIME_GOOD(-0.10)[multipart/mixed] X-Rspamd-Server: antispam X-Rspamd-Scan-Time: 0.37 X-Rspamd-Queue-ID: D24918003EE X-Spam: yes ``` Still those messages are kept in my INBOX and not moved to Junk or marked as read. It seems to me, that the dovecot sieve scripts are outdated or targeted at some other spamfilter (`X-Spam-Status`, spamassassin?) and not effective anymore. How do I achieve the same result (automatically move spam to junk and mark it read) with the current images? Thanks, Christoph
Thanks for reporting this, it seems indeed that the latest Rspamd version does not add the `X-Spam-Status` header. We should spend some time matching the `X-Spamd-Result` header, which was a hassle some time ago unfortunately. Maybe I can find some time to help out here. For starters, I'll try to figure out how to debug sieve scripts ;). Debugging sieve scripts is painful. You can start by enabling `mail_debug` in Dovecot. Thanks for your help!
2016-09-30T09:27:13
Mailu/Mailu
75
Mailu__Mailu-75
[ "37" ]
676a9a5d2c71856d00a6f3313db28e617b63f311
diff --git a/admin/freeposte/__init__.py b/admin/freeposte/__init__.py --- a/admin/freeposte/__init__.py +++ b/admin/freeposte/__init__.py @@ -4,6 +4,7 @@ import flask_login import flask_script import flask_migrate +import flask_babel import os import docker @@ -23,7 +24,9 @@ 'DEBUG': False, 'BOOTSTRAP_SERVE_LOCAL': True, 'DKIM_PATH': '/dkim/{domain}.{selector}.key', - 'DKIM_SELECTOR': 'dkim' + 'DKIM_SELECTOR': 'dkim', + 'BABEL_DEFAULT_LOCALE': 'en', + 'BABEL_DEFAULT_TIMEZONE': 'UTC' } # Load configuration from the environment if available @@ -36,6 +39,7 @@ migrate = flask_migrate.Migrate(app, db) login_manager = flask_login.LoginManager() login_manager.init_app(app) +babel = flask_babel.Babel(app) # Manager commnad manager = flask_script.Manager(app) diff --git a/admin/freeposte/admin/forms.py b/admin/freeposte/admin/forms.py --- a/admin/freeposte/admin/forms.py +++ b/admin/freeposte/admin/forms.py @@ -1,5 +1,6 @@ from wtforms import validators, fields, widgets from wtforms_components import fields as fields_ +from flask_babel import lazy_gettext as _ import flask_login import flask_wtf @@ -28,92 +29,93 @@ def iter_choices(self): def pre_validate(self, form): for item in self.data: if not self.validator.match(item): - raise validators.ValidationError("Invalid email address.") + raise validators.ValidationError(_('Invalid email address.')) -class Confirmation(flask_wtf.FlaskForm): - submit = fields.SubmitField('Confirm') +class ConfirmationForm(flask_wtf.FlaskForm): + submit = fields.SubmitField(_('Confirm')) class LoginForm(flask_wtf.FlaskForm): - email = fields.StringField('E-mail', [validators.Email()]) - pw = fields.PasswordField('Password', [validators.DataRequired()]) - submit = fields.SubmitField('Sign in') + email = fields.StringField(_('E-mail'), [validators.Email()]) + pw = fields.PasswordField(_('Password'), [validators.DataRequired()]) + submit = fields.SubmitField(_('Sign in')) class DomainForm(flask_wtf.FlaskForm): - name = fields.StringField('Domain name', [validators.DataRequired()]) - max_users = fields_.IntegerField('Maximum user count', default=10) - max_aliases = fields_.IntegerField('Maximum alias count', default=10) - comment = fields.StringField('Comment') - submit = fields.SubmitField('Create') + name = fields.StringField(_('Domain name'), [validators.DataRequired()]) + max_users = fields_.IntegerField(_('Maximum user count'), default=10) + max_aliases = fields_.IntegerField(_('Maximum alias count'), default=10) + comment = fields.StringField(_('Comment')) + submit = fields.SubmitField(_('Create')) class UserForm(flask_wtf.FlaskForm): - localpart = fields.StringField('E-mail', [validators.DataRequired()]) - pw = fields.PasswordField('Password', [validators.DataRequired()]) - pw2 = fields.PasswordField('Confirm password', [validators.EqualTo('pw')]) - quota_bytes = fields_.IntegerSliderField('Quota', default=1000000000) - enable_imap = fields.BooleanField('Allow IMAP access', default=True) - enable_pop = fields.BooleanField('Allow POP3 access', default=True) - comment = fields.StringField('Comment') - submit = fields.SubmitField('Save') + localpart = fields.StringField(_('E-mail'), [validators.DataRequired()]) + pw = fields.PasswordField(_('Password'), [validators.DataRequired()]) + pw2 = fields.PasswordField(_('Confirm password'), [validators.EqualTo('pw')]) + quota_bytes = fields_.IntegerSliderField(_('Quota'), default=1000000000) + enable_imap = fields.BooleanField(_('Allow IMAP access'), default=True) + enable_pop = fields.BooleanField(_('Allow POP3 access'), default=True) + comment = fields.StringField(_('Comment')) + submit = fields.SubmitField(_('Save')) class UserSettingsForm(flask_wtf.FlaskForm): - displayed_name = fields.StringField('Displayed name') - spam_enabled = fields.BooleanField('Enable spam filter') - spam_threshold = fields_.IntegerSliderField('Spam filter threshold') - submit = fields.SubmitField('Save settings') + displayed_name = fields.StringField(_('Displayed name')) + spam_enabled = fields.BooleanField(_('Enable spam filter')) + spam_threshold = fields_.IntegerSliderField(_('Spam filter threshold')) + submit = fields.SubmitField(_('Save settings')) class UserPasswordForm(flask_wtf.FlaskForm): - pw = fields.PasswordField('Password', [validators.DataRequired()]) - pw2 = fields.PasswordField('Password check', [validators.DataRequired()]) - submit = fields.SubmitField('Update password') + pw = fields.PasswordField(_('Password'), [validators.DataRequired()]) + pw2 = fields.PasswordField(_('Password check'), [validators.DataRequired()]) + submit = fields.SubmitField(_('Update password')) class UserForwardForm(flask_wtf.FlaskForm): - forward_enabled = fields.BooleanField('Enable forwarding') + forward_enabled = fields.BooleanField(_('Enable forwarding')) forward_destination = fields.StringField( - 'Destination', [validators.Optional(), validators.Email()] + _('Destination'), [validators.Optional(), validators.Email()] ) - submit = fields.SubmitField('Update') + submit = fields.SubmitField(_('Update')) class UserReplyForm(flask_wtf.FlaskForm): - reply_enabled = fields.BooleanField('Enable automatic reply') - reply_subject = fields.StringField('Reply subject') - reply_body = fields.StringField('Reply body', widget=widgets.TextArea()) - submit = fields.SubmitField('Update') + reply_enabled = fields.BooleanField(_('Enable automatic reply')) + reply_subject = fields.StringField(_('Reply subject')) + reply_body = fields.StringField(_('Reply body'), + widget=widgets.TextArea()) + submit = fields.SubmitField(_('Update')) class AliasForm(flask_wtf.FlaskForm): - localpart = fields.StringField('Alias', [validators.DataRequired()]) + localpart = fields.StringField(_('Alias'), [validators.DataRequired()]) wildcard = fields.BooleanField( - 'Use SQL Like Syntax (e.g. for catch-all aliases, admin-%@domain.com)') - destination = DestinationField('Destination') - comment = fields.StringField('Comment') - submit = fields.SubmitField('Create') + _('Use SQL LIKE Syntax (e.g. for catch-all aliases)')) + destination = DestinationField(_('Destination')) + comment = fields.StringField(_('Comment')) + submit = fields.SubmitField(_('Create')) class AdminForm(flask_wtf.FlaskForm): - admin = fields.SelectField('Admin email', choices=[]) - submit = fields.SubmitField('Submit') + admin = fields.SelectField(_('Admin email'), choices=[]) + submit = fields.SubmitField(_('Submit')) class ManagerForm(flask_wtf.FlaskForm): - manager = fields.SelectField('Manager email') - submit = fields.SubmitField('Submit') + manager = fields.SelectField(_('Manager email')) + submit = fields.SubmitField(_('Submit')) class FetchForm(flask_wtf.FlaskForm): - protocol = fields.SelectField('Protocol', choices=[ + protocol = fields.SelectField(_('Protocol'), choices=[ ('imap', 'IMAP'), ('pop3', 'POP3') ]) - host = fields.StringField('Hostname or IP') - port = fields.IntegerField('TCP port') - tls = fields.BooleanField('Enable TLS') - username = fields.StringField('Username') - password = fields.StringField('Password') - submit = fields.SubmitField('Submit') + host = fields.StringField(_('Hostname or IP')) + port = fields.IntegerField(_('TCP port')) + tls = fields.BooleanField(_('Enable TLS')) + username = fields.StringField(_('Username')) + password = fields.StringField(_('Password')) + submit = fields.SubmitField(_('Submit'))
Add support for I18N
2016-10-02T15:39:36
Mailu/Mailu
247
Mailu__Mailu-247
[ "243" ]
213ee1d8b62e5b8b77aa952d3cdcf6d7c6597182
diff --git a/admin/mailu/admin/forms.py b/admin/mailu/admin/forms.py --- a/admin/mailu/admin/forms.py +++ b/admin/mailu/admin/forms.py @@ -77,6 +77,7 @@ class UserPasswordForm(flask_wtf.FlaskForm): class UserForwardForm(flask_wtf.FlaskForm): forward_enabled = fields.BooleanField(_('Enable forwarding')) + forward_keep = fields.BooleanField(_('Keep a copy of the emails')) forward_destination = fields.StringField( _('Destination'), [validators.Optional(), validators.Email()] ) diff --git a/admin/mailu/admin/models.py b/admin/mailu/admin/models.py --- a/admin/mailu/admin/models.py +++ b/admin/mailu/admin/models.py @@ -146,6 +146,7 @@ class User(Base, Email): # Filters forward_enabled = db.Column(db.Boolean(), nullable=False, default=False) forward_destination = db.Column(db.String(255), nullable=True, default=None) + forward_keep = db.Column(db.Boolean(), nullable=False, default=True) reply_enabled = db.Column(db.Boolean(), nullable=False, default=False) reply_subject = db.Column(db.String(255), nullable=True, default=None) reply_body = db.Column(db.Text(), nullable=True, default=None) diff --git a/admin/migrations/versions/73e56bad5ec5_.py b/admin/migrations/versions/73e56bad5ec5_.py new file mode 100644 --- /dev/null +++ b/admin/migrations/versions/73e56bad5ec5_.py @@ -0,0 +1,24 @@ +""" Add the ability to keep forwarded messages + +Revision ID: 73e56bad5ec5 +Revises: 3f6994568962 +Create Date: 2017-09-03 15:36:07.821002 + +""" + +# revision identifiers, used by Alembic. +revision = '73e56bad5ec5' +down_revision = '3f6994568962' + +from alembic import op +import sqlalchemy as sa + + +def upgrade(): + with op.batch_alter_table('user') as batch: + batch.add_column(sa.Column('forward_keep', sa.Boolean(), nullable=False, server_default=sa.sql.expression.true())) + + +def downgrade(): + with op.batch_alter_table('user') as batch: + batch.drop_column('forward_keep')
Forward E-mails without storing them in Mailu I think it would be useful to have a checkbox in E-mail Forward to let the user choose whether to store a copy of them in Mailu or simply forward to another address.
That would be an interesting feature, could be implemented by tweaking the SQL queries when resolving aliases in Postfix.
2017-09-03T14:05:28
Mailu/Mailu
451
Mailu__Mailu-451
[ "450" ]
db0cd8efb40ca9d4501e7dae2539079e0c25db96
diff --git a/core/admin/mailu/models.py b/core/admin/mailu/models.py --- a/core/admin/mailu/models.py +++ b/core/admin/mailu/models.py @@ -162,7 +162,7 @@ def sendmail(self, subject, body): """ from_address = '{}@{}'.format( app.config['POSTMASTER'], app.config['DOMAIN']) - with smtplib.SMTP('smtp', port=10025) as smtp: + with smtplib.SMTP(app.config['HOST_AUTHSMTP'], port=10025) as smtp: msg = text.MIMEText(body) msg['Subject'] = subject msg['From'] = from_address
Internal Server Error in admin page Looks like a reference to the auto-forward page was left behind when Settings / Forwarding were merged. Clicking the link on /ui/user/list page results in an ISE. Will submit a PR to fix shortly.
2018-04-14T21:49:29
Mailu/Mailu
633
Mailu__Mailu-633
[ "390" ]
2124df36eca9ad879f5f32b30cf85ec1b1cc7174
diff --git a/core/admin/mailu/internal/views/postfix.py b/core/admin/mailu/internal/views/postfix.py --- a/core/admin/mailu/internal/views/postfix.py +++ b/core/admin/mailu/internal/views/postfix.py @@ -18,37 +18,34 @@ def postfix_mailbox_map(email): @internal.route("/postfix/alias/<alias>") def postfix_alias_map(alias): - localpart, domain = alias.split('@', 1) if '@' in alias else (None, alias) - alternative = models.Alternative.query.get(domain) - if alternative: - domain = alternative.domain_name - email = '{}@{}'.format(localpart, domain) + localpart, domain_name = models.Email.resolve_domain(alias) if localpart is None: - return flask.jsonify(domain) - else: - alias_obj = models.Alias.resolve(localpart, domain) - if alias_obj: - return flask.jsonify(",".join(alias_obj.destination)) - user_obj = models.User.query.get(email) - if user_obj: - return flask.jsonify(user_obj.destination) - return flask.abort(404) + return flask.jsonify(domain_name) + destination = models.Email.resolve_destination(localpart, domain_name) + return flask.jsonify(",".join(destination)) if destination else flask.abort(404) @internal.route("/postfix/transport/<email>") def postfix_transport(email): - localpart, domain = email.split('@', 1) if '@' in email else (None, email) - relay = models.Relay.query.get(domain) or flask.abort(404) + if email == '*': + return flask.abort(404) + localpart, domain_name = models.Email.resolve_domain(email) + relay = models.Relay.query.get(domain_name) or flask.abort(404) return flask.jsonify("smtp:[{}]".format(relay.smtp)) [email protected]("/postfix/sender/<sender>") -def postfix_sender(sender): [email protected]("/postfix/sender/login/<sender>") +def postfix_sender_login(sender): + localpart, domain_name = models.Email.resolve_domain(sender) + if localpart is None: + return flask.abort(404) + destination = models.Email.resolve_destination(localpart, domain_name, True) + return flask.jsonify(",".join(destination)) if destination else flask.abort(404) + + [email protected]("/postfix/sender/access/<sender>") +def postfix_sender_access(sender): """ Simply reject any sender that pretends to be from a local domain """ - localpart, domain_name = sender.split('@', 1) if '@' in sender else (None, sender) - domain = models.Domain.query.get(domain_name) - alternative = models.Alternative.query.get(domain_name) - if domain or alternative: - return flask.jsonify("REJECT") - return flask.abort(404) + localpart, domain_name = models.Email.resolve_domain(sender) + return flask.jsonify("REJECT") if models.Domain.query.get(domain_name) else flask.abort(404) diff --git a/core/admin/mailu/models.py b/core/admin/mailu/models.py --- a/core/admin/mailu/models.py +++ b/core/admin/mailu/models.py @@ -64,7 +64,7 @@ def process_bind_param(self, value, dialect): return ",".join(value) def process_result_value(self, value, dialect): - return filter(bool, value.split(",")) + return filter(bool, value.split(",")) if value else [] # Many-to-many association table for domain managers @@ -221,6 +221,28 @@ def sendmail(self, subject, body): msg['To'] = to_address smtp.sendmail(from_address, [to_address], msg.as_string()) + @classmethod + def resolve_domain(cls, email): + localpart, domain_name = email.split('@', 1) if '@' in email else (None, email) + alternative = Alternative.query.get(domain_name) + if alternative: + domain_name = alternative.domain_name + return (localpart, domain_name) + + @classmethod + def resolve_destination(cls, localpart, domain_name, ignore_forward_keep=False): + alias = Alias.resolve(localpart, domain_name) + if alias: + return alias.destination + user = User.query.get('{}@{}'.format(localpart, domain_name)) + if user: + if user.forward_enabled: + destination = user.forward_destination + if user.forward_keep or ignore_forward_keep: + destination.append(user.email) + else: + destination = [user.email] + return destination def __str__(self): return self.email @@ -245,7 +267,7 @@ class User(Base, Email): # Filters forward_enabled = db.Column(db.Boolean(), nullable=False, default=False) - forward_destination = db.Column(db.String(255), nullable=True, default=None) + forward_destination = db.Column(CommaSeparatedList(), nullable=True, default=[]) forward_keep = db.Column(db.Boolean(), nullable=False, default=True) reply_enabled = db.Column(db.Boolean(), nullable=False, default=False) reply_subject = db.Column(db.String(255), nullable=True, default=None) diff --git a/core/postfix/start.py b/core/postfix/start.py --- a/core/postfix/start.py +++ b/core/postfix/start.py @@ -19,7 +19,8 @@ def start_podop(): ("alias", "url", "http://admin/internal/postfix/alias/ยง"), ("domain", "url", "http://admin/internal/postfix/domain/ยง"), ("mailbox", "url", "http://admin/internal/postfix/mailbox/ยง"), - ("sender", "url", "http://admin/internal/postfix/sender/ยง") + ("senderaccess", "url", "http://admin/internal/postfix/sender/access/ยง"), + ("senderlogin", "url", "http://admin/internal/postfix/sender/login/ยง") ]) convert = lambda src, dst: open(dst, "w").write(jinja2.Template(open(src).read()).render(**os.environ))
Can't send from an email account that has forwarding I've setup an email account (for example "[email protected]"). I then turn on forwarding so that all emails to "[email protected]" will be forwarded to "[email protected]". However when doing this I can no longer send emails from "[email protected]", when doing (either via SMTP directly or roundcube) I get error such as: > An error occurred while sending mail. The mail server responded: > 5.7.1 <[email protected]>: Sender address rejected: not owned by user [email protected]. > Please check the message recipient "[email protected]" and try again.
Sorry for the delay. Indeed the sender restrictions will cause an issue with this. For the time being, try checking the box "keep a local copy". The reasoning is: if your sender address does not have your username as destination, it is rejected. So keeping a local copy will make your local user a recipient of the messages and thus temporarily fix the issue. I have to think about a long term fix, which will not be easy. This can finally be fixed once we implement #420. Then we can finally specify any behavior for allowing impersonation, I will start with fixing the current ux.
2018-10-07T14:27:51
Mailu/Mailu
665
Mailu__Mailu-665
[ "362" ]
4a5c0a6d21e92c6a562312bf7140b39be32729cc
diff --git a/core/admin/mailu/models.py b/core/admin/mailu/models.py --- a/core/admin/mailu/models.py +++ b/core/admin/mailu/models.py @@ -250,6 +250,8 @@ class User(Base, Email): reply_enabled = db.Column(db.Boolean(), nullable=False, default=False) reply_subject = db.Column(db.String(255), nullable=True, default=None) reply_body = db.Column(db.Text(), nullable=True, default=None) + reply_startdate = db.Column(db.Date, nullable=False, + default=date(1900, 1, 1)) reply_enddate = db.Column(db.Date, nullable=False, default=date(2999, 12, 31)) @@ -276,6 +278,15 @@ def destination(self): else: return self.email + @property + def reply_active(self): + now = date.today() + return ( + self.reply_enabled and + self.reply_startdate < now and + self.reply_enddate > now + ) + scheme_dict = {'PBKDF2': "pbkdf2_sha512", 'BLF-CRYPT': "bcrypt", 'SHA512-CRYPT': "sha512_crypt", diff --git a/core/admin/mailu/ui/forms.py b/core/admin/mailu/ui/forms.py --- a/core/admin/mailu/ui/forms.py +++ b/core/admin/mailu/ui/forms.py @@ -117,6 +117,7 @@ class UserReplyForm(flask_wtf.FlaskForm): reply_subject = fields.StringField(_('Reply subject')) reply_body = fields.StringField(_('Reply body'), widget=widgets.TextArea()) + reply_startdate = fields.html5.DateField(_('Start of vacation')) reply_enddate = fields.html5.DateField(_('End of vacation')) submit = fields.SubmitField(_('Update')) diff --git a/core/admin/migrations/versions/3b281286c7bd_.py b/core/admin/migrations/versions/3b281286c7bd_.py new file mode 100644 --- /dev/null +++ b/core/admin/migrations/versions/3b281286c7bd_.py @@ -0,0 +1,24 @@ +""" Add a start day for vacations + +Revision ID: 3b281286c7bd +Revises: 25fd6c7bcb4a +Create Date: 2018-09-27 22:20:08.158553 + +""" + +revision = '3b281286c7bd' +down_revision = '25fd6c7bcb4a' + +from alembic import op +import sqlalchemy as sa + + +def upgrade(): + with op.batch_alter_table('user') as batch: + batch.add_column(sa.Column('reply_startdate', sa.Date(), nullable=False, + server_default="1900-01-01")) + + +def downgrade(): + with op.batch_alter_table('user') as batch: + batch.drop_column('reply_startdate')
Vacation: fields start I have requests from customers who would like to put their vocations in advance. In fact, can we put a start field in vocation ?
Agreed, and it should be straightforward to implement
2018-10-16T21:57:00
Mailu/Mailu
667
Mailu__Mailu-667
[ "635" ]
7c82be904f6bcbb82fb1ed3805644a981d246b19
diff --git a/core/admin/mailu/__init__.py b/core/admin/mailu/__init__.py --- a/core/admin/mailu/__init__.py +++ b/core/admin/mailu/__init__.py @@ -12,7 +12,7 @@ import socket import uuid -from werkzeug.contrib import fixers +from werkzeug.contrib import fixers, profiler # Create application app = flask.Flask(__name__) @@ -62,7 +62,10 @@ 'HOST_IMAP': 'imap', 'HOST_POP3': 'imap', 'HOST_SMTP': 'smtp', + 'HOST_WEBMAIL': 'webmail', + 'HOST_FRONT': 'front', 'HOST_AUTHSMTP': os.environ.get('HOST_SMTP', 'smtp'), + 'POD_ADDRESS_RANGE': None } # Load configuration from the environment if available @@ -80,6 +83,10 @@ import flask_debugtoolbar toolbar = flask_debugtoolbar.DebugToolbarExtension(app) +# Profiler +if app.config.get("DEBUG"): + app.wsgi_app = profiler.ProfilerMiddleware(app.wsgi_app, restrictions=[30]) + # Manager commnad manager = flask_script.Manager(app) manager.add_command('db', flask_migrate.MigrateCommand) @@ -129,4 +136,5 @@ def __call__(self, environ, start_response): environ['SCRIPT_NAME'] = prefix return self.app(environ, start_response) + app.wsgi_app = PrefixMiddleware(fixers.ProxyFix(app.wsgi_app)) diff --git a/core/admin/mailu/internal/views/dovecot.py b/core/admin/mailu/internal/views/dovecot.py --- a/core/admin/mailu/internal/views/dovecot.py +++ b/core/admin/mailu/internal/views/dovecot.py @@ -1,14 +1,24 @@ -from mailu import db, models +from mailu import db, models, app from mailu.internal import internal import flask +import socket @internal.route("/dovecot/passdb/<user_email>") def dovecot_passdb_dict(user_email): user = models.User.query.get(user_email) or flask.abort(404) + allow_nets = [] + allow_nets.append( + app.config.get("POD_ADDRESS_RANGE") or + socket.gethostbyname(app.config["HOST_FRONT"]) + ) + allow_nets.append(socket.gethostbyname(app.config["HOST_WEBMAIL"])) + print(allow_nets) return flask.jsonify({ - "password": user.password, + "password": None, + "nopassword": "Y", + "allow_nets": ",".join(allow_nets) }) diff --git a/core/admin/mailu/models.py b/core/admin/mailu/models.py --- a/core/admin/mailu/models.py +++ b/core/admin/mailu/models.py @@ -276,7 +276,8 @@ def destination(self): else: return self.email - scheme_dict = {'BLF-CRYPT': "bcrypt", + scheme_dict = {'PBKDF2': "pbkdf2_sha512", + 'BLF-CRYPT': "bcrypt", 'SHA512-CRYPT': "sha512_crypt", 'SHA256-CRYPT': "sha256_crypt", 'MD5-CRYPT': "md5_crypt", @@ -287,8 +288,14 @@ def destination(self): ) def check_password(self, password): + context = User.pw_context reference = re.match('({[^}]+})?(.*)', self.password).group(2) - return User.pw_context.verify(password, reference) + result = context.verify(password, reference) + if result and context.identify(reference) != context.default_scheme(): + self.set_password(password) + db.session.add(self) + db.session.commit() + return result def set_password(self, password, hash_scheme=app.config['PASSWORD_SCHEME'], raw=False): """Set password for user with specified encryption scheme
support PBKDF2 and use it as default PBKDF2-SHA512 is as secure as SHA512-CRYPT but works in constant-time based on the rounds, not the length of the password - eliminating the leakage of password-length based on timing this should also reduce the performance impact as reported by #546 (in my local tests with the script by @t-t-yano PBKDF2-SHA512 is 2-3x faster than SHA512-CRYPT)
Oh well :grimacing: If I understand it correct, before the merge of #612 the password was never actually passed to dovecot, right? Now that it is passed the problem is: passlib uses a different prefix than dovecot to indicate that the hash is a PBKDF2 Hash-Prefixes in Passlib: `$pbkdf2-sha512$` Dovecot: `$1$` (btw, dovecot are you drunk? the prefix `$1$` is used for the least secure supported hash (MD5-CRYPT) _AND_ for one of the most secure? โ€ฆalso: that is not documented, one has to grep it from the source code by errormessage :disappointed:) I created an alternative PR #647 that just works so I will close this one now. The password is not passed to Dovecot. What is weird is this change worked pretty well for me. Let's switch to the alternative anyway. Edit: hm. Indeed, the password is passed to Dovecot since the abstract db thing. I will probably open a discussion about this. Anyway, let's switch to #647 indeed.
2018-10-17T19:27:20
Mailu/Mailu
684
Mailu__Mailu-684
[ "683" ]
2124df36eca9ad879f5f32b30cf85ec1b1cc7174
diff --git a/core/admin/mailu/models.py b/core/admin/mailu/models.py --- a/core/admin/mailu/models.py +++ b/core/admin/mailu/models.py @@ -271,7 +271,7 @@ def get_id(self): @property def destination(self): if self.forward_enabled: - result = self.self.forward_destination + result = self.forward_destination if self.forward_keep: result += ',' + self.email return result
'User' object has no attribute 'self' I've been getting the following error recently for emails that are sent to forwarded addresses: ``` Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1982, in wsgi_app response = self.full_dispatch_request() File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1614, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1517, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 33, in reraise raise value File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1612, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1598, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/app/mailu/internal/views/postfix.py", line 34, in postfix_alias_map return flask.jsonify(user_obj.destination) File "/app/mailu/models.py", line 274, in destination result = self.self.forward_destination AttributeError: 'User' object has no attribute 'self' ``` Looks like it might be a typo on that line. I will test a fix shortly and submit a PR if successful.
2018-10-23T16:08:05
Mailu/Mailu
699
Mailu__Mailu-699
[ "585" ]
09abaff9b62e857022c85b01947381a4c6df0147
diff --git a/core/admin/mailu/models.py b/core/admin/mailu/models.py --- a/core/admin/mailu/models.py +++ b/core/admin/mailu/models.py @@ -35,11 +35,14 @@ class IdnaEmail(db.TypeDecorator): impl = db.String(255, collation="NOCASE") def process_bind_param(self, value, dialect): - localpart, domain_name = value.split('@') - return "{0}@{1}".format( - localpart, - idna.encode(domain_name).decode('ascii'), - ) + try: + localpart, domain_name = value.split('@') + return "{0}@{1}".format( + localpart, + idna.encode(domain_name).decode('ascii'), + ) + except ValueError: + pass def process_result_value(self, value, dialect): localpart, domain_name = value.split('@')
admin_1 errors in the logs I'm seeing a lot of errors in the docker-compose logs: ``` admin_1 | 2018-09-06T03:27:32.130634316Z File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 667, in _init_compiled admin_1 | 2018-09-06T03:27:32.130647067Z param.append(processors[key](compiled_params[key])) admin_1 | 2018-09-06T03:27:32.130651784Z File "/usr/local/lib/python3.7/site-packages/sqlalchemy/sql/type_api.py", line 1160, in process admin_1 | 2018-09-06T03:27:32.130656339Z return process_param(value, dialect) admin_1 | 2018-09-06T03:27:32.130660848Z File "/app/mailu/models.py", line 38, in process_bind_param admin_1 | 2018-09-06T03:27:32.130678553Z localpart, domain_name = value.split('@') admin_1 | 2018-09-06T03:27:32.130682552Z ValueError: not enough values to unpack (expected 2, got 1) admin_1 | 2018-09-06T03:27:32.130686500Z admin_1 | 2018-09-06T03:27:32.130690498Z The above exception was the direct cause of the following exception: admin_1 | 2018-09-06T03:27:32.130694402Z admin_1 | 2018-09-06T03:27:32.130698152Z Traceback (most recent call last): admin_1 | 2018-09-06T03:27:32.130701929Z File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1982, in wsgi_app admin_1 | 2018-09-06T03:27:32.130706019Z response = self.full_dispatch_request() admin_1 | 2018-09-06T03:27:32.130728757Z File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1614, in full_dispatch_request admin_1 | 2018-09-06T03:27:32.130734376Z rv = self.handle_user_exception(e) admin_1 | 2018-09-06T03:27:32.130738349Z File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1517, in handle_user_exception admin_1 | 2018-09-06T03:27:32.130742416Z reraise(exc_type, exc_value, tb) admin_1 | 2018-09-06T03:27:32.130746585Z File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 33, in reraise admin_1 | 2018-09-06T03:27:32.130750772Z raise value admin_1 | 2018-09-06T03:27:32.130754541Z File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1612, in full_dispatch_request admin_1 | 2018-09-06T03:27:32.130758592Z rv = self.dispatch_request() admin_1 | 2018-09-06T03:27:32.130762451Z File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1598, in dispatch_request admin_1 | 2018-09-06T03:27:32.130766443Z return self.view_functions[rule.endpoint](**req.view_args) admin_1 | 2018-09-06T03:27:32.130770363Z File "/usr/local/lib/python3.7/site-packages/flask_limiter/extension.py", line 544, in __inner admin_1 | 2018-09-06T03:27:32.130774389Z return obj(*a, **k) admin_1 | 2018-09-06T03:27:32.130778164Z File "/app/mailu/internal/views.py", line 18, in nginx_authentication admin_1 | 2018-09-06T03:27:32.130782201Z headers = nginx.handle_authentication(flask.request.headers) admin_1 | 2018-09-06T03:27:32.130785989Z File "/app/mailu/internal/nginx.py", line 40, in handle_authentication admin_1 | 2018-09-06T03:27:32.130789994Z user = models.User.query.get(user_email) admin_1 | 2018-09-06T03:27:32.130797166Z File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 882, in get admin_1 | 2018-09-06T03:27:32.130801365Z ident, loading.load_on_ident) admin_1 | 2018-09-06T03:27:32.130805123Z File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 916, in _get_impl admin_1 | 2018-09-06T03:27:32.130809141Z return fallback_fn(self, key) admin_1 | 2018-09-06T03:27:32.130812954Z File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/loading.py", line 232, in load_on_ident admin_1 | 2018-09-06T03:27:32.130817023Z return q.one() admin_1 | 2018-09-06T03:27:32.130820651Z File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 2848, in one admin_1 | 2018-09-06T03:27:32.130828433Z ret = self.one_or_none() admin_1 | 2018-09-06T03:27:32.130832204Z File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 2818, in one_or_none admin_1 | 2018-09-06T03:27:32.130836182Z ret = list(self) admin_1 | 2018-09-06T03:27:32.130839817Z File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 2889, in __iter__ admin_1 | 2018-09-06T03:27:32.130843800Z return self._execute_and_instances(context) admin_1 | 2018-09-06T03:27:32.130847637Z File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 2912, in _execute_and_instances admin_1 | 2018-09-06T03:27:32.130851651Z result = conn.execute(querycontext.statement, self._params) admin_1 | 2018-09-06T03:27:32.130855429Z File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 948, in execute admin_1 | 2018-09-06T03:27:32.130859405Z return meth(self, multiparams, params) admin_1 | 2018-09-06T03:27:32.130863160Z File "/usr/local/lib/python3.7/site-packages/sqlalchemy/sql/elements.py", line 269, in _execute_on_connection admin_1 | 2018-09-06T03:27:32.130867285Z return connection._execute_clauseelement(self, multiparams, params) admin_1 | 2018-09-06T03:27:32.130871120Z File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1060, in _execute_clauseelement admin_1 | 2018-09-06T03:27:32.130875220Z compiled_sql, distilled_params admin_1 | 2018-09-06T03:27:32.130879000Z File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1132, in _execute_context admin_1 | 2018-09-06T03:27:32.130883223Z None, None) admin_1 | 2018-09-06T03:27:32.130886963Z File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1413, in _handle_dbapi_exception admin_1 | 2018-09-06T03:27:32.130891179Z exc_info admin_1 | 2018-09-06T03:27:32.130894835Z File "/usr/local/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause admin_1 | 2018-09-06T03:27:32.130898868Z reraise(type(exception), exception, tb=exc_tb, cause=cause) admin_1 | 2018-09-06T03:27:32.130902641Z File "/usr/local/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 186, in reraise admin_1 | 2018-09-06T03:27:32.130906662Z raise value.with_traceback(tb) admin_1 | 2018-09-06T03:27:32.130910358Z File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1127, in _execute_context admin_1 | 2018-09-06T03:27:32.130915002Z context = constructor(dialect, self, conn, *args) admin_1 | 2018-09-06T03:27:32.130918761Z File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 667, in _init_compiled admin_1 | 2018-09-06T03:27:32.130922838Z param.append(processors[key](compiled_params[key])) admin_1 | 2018-09-06T03:27:32.130926576Z File "/usr/local/lib/python3.7/site-packages/sqlalchemy/sql/type_api.py", line 1160, in process admin_1 | 2018-09-06T03:27:32.130930646Z return process_param(value, dialect) admin_1 | 2018-09-06T03:27:32.130934389Z File "/app/mailu/models.py", line 38, in process_bind_param admin_1 | 2018-09-06T03:27:32.130938334Z localpart, domain_name = value.split('@') admin_1 | 2018-09-06T03:27:32.130949412Z sqlalchemy.exc.StatementError: (builtins.ValueError) not enough values to unpack (expected 2, got 1) [SQL: 'SELECT user.created_at AS user_created_at, user.updated_at AS user_updated_at, user.comment AS user_comment, user.localpart AS user_localpart, user.password AS user_password, user.quota_bytes AS user_quota_bytes, user.global_admin AS user_global_admin, user.enabled AS user_enabled, user.enable_imap AS user_enable_imap, user.enable_pop AS user_enable_pop, user.forward_enabled AS user_forward_enabled, user.forward_destination AS user_forward_destination, user.forward_keep AS user_forward_keep, user.reply_enabled AS user_reply_enabled, user.reply_subject AS user_reply_subject, user.reply_body AS user_reply_body, user.reply_enddate AS user_reply_enddate, user.displayed_name AS user_displayed_name, user.spam_enabled AS user_spam_enabled, user.spam_threshold AS user_spam_threshold, user.domain_name AS user_domain_name, user.email AS user_email \nFROM user \nWHERE user.email = ?'] [parameters: [{'%(140175638833808 param)s': 'scan'}]] ```
I have this error in my logs too. It happens when bots try random logins. In your provided log they try the user "scan". So I tested it with a manual connection to my mailu instance. If I try to login with an account without domain I get the same log and the server response with an internal server error: ``` . OK completed > a001 LOGIN joe password * BAD internal server error closed ``` If I try a username with domain ([email protected]) I got the right response: ``` . OK completed a001 LOGIN [email protected] password a001 NO Authentication credentials invalid closed ``` So I think logins with user accounts without domain name cause the bug.
2018-11-02T10:17:46
Mailu/Mailu
705
Mailu__Mailu-705
[ "578" ]
5c2439011413a114c470862f95206f8487fa4568
diff --git a/core/admin/mailu/ui/forms.py b/core/admin/mailu/ui/forms.py --- a/core/admin/mailu/ui/forms.py +++ b/core/admin/mailu/ui/forms.py @@ -90,9 +90,10 @@ class UserSignupForm(flask_wtf.FlaskForm): localpart = fields.StringField(_('Email address'), [validators.DataRequired(), validators.Regexp(LOCALPART_REGEX)]) pw = fields.PasswordField(_('Password'), [validators.DataRequired()]) pw2 = fields.PasswordField(_('Confirm password'), [validators.EqualTo('pw')]) - captcha = flask_wtf.RecaptchaField() submit = fields.SubmitField(_('Sign up')) +class UserSignupFormCaptcha(UserSignupForm): + captcha = flask_wtf.RecaptchaField() class UserSettingsForm(flask_wtf.FlaskForm): displayed_name = fields.StringField(_('Displayed name')) diff --git a/core/admin/mailu/ui/views/users.py b/core/admin/mailu/ui/views/users.py --- a/core/admin/mailu/ui/views/users.py +++ b/core/admin/mailu/ui/views/users.py @@ -170,7 +170,11 @@ def user_signup(domain_name=None): available_domains=available_domains) domain = available_domains.get(domain_name) or flask.abort(404) quota_bytes = domain.max_quota_bytes or app.config['DEFAULT_QUOTA'] - form = forms.UserSignupForm() + if app.config['RECAPTCHA_PUBLIC_KEY'] == "" or app.config['RECAPTCHA_PRIVATE_KEY'] == "": + form = forms.UserSignupForm() + else: + form = forms.UserSignupFormCaptcha() + if form.validate_on_submit(): if domain.has_email(form.localpart.data): flask.flash('Email is already used', 'error')
signup submit show The response parameter is missing ![image](https://user-images.githubusercontent.com/14049597/44628410-dd0fd100-a971-11e8-9962-002865f4a2d5.png)
This is a bug when not enabling recaptcha. okay i fixed after add recaptcha client id and secret @ionutfilip. you know how to play with validation in Flask now ;).
2018-11-09T10:50:24
Mailu/Mailu
719
Mailu__Mailu-719
[ "718" ]
5c2439011413a114c470862f95206f8487fa4568
diff --git a/core/admin/mailu/internal/views/postfix.py b/core/admin/mailu/internal/views/postfix.py --- a/core/admin/mailu/internal/views/postfix.py +++ b/core/admin/mailu/internal/views/postfix.py @@ -6,7 +6,9 @@ @internal.route("/postfix/domain/<domain_name>") def postfix_mailbox_domain(domain_name): - domain = models.Domain.query.get(domain_name) or flask.abort(404) + domain = models.Domain.query.get(domain_name) or \ + models.Alternative.query.get(domain_name) or \ + flask.abort(404) return flask.jsonify(domain.name)
Alternatives useless after podop After updating to master to get all the up-to-date fixes it also moves postfix to use podop and it seems to no longer support receiving external mail from alternative domains ๐Ÿ˜ข Sending internal mail between alternatives works as expected but not with external mail, a "relay denied" message is shown in the logs and when checking the postfix podop views it looks like alternative is never mentioned.
2018-12-02T11:22:59
Mailu/Mailu
731
Mailu__Mailu-731
[ "542" ]
a2a9512afaf3cc550820dc0f42c77c3b0fcd7929
diff --git a/webmails/rainloop/start.py b/webmails/rainloop/start.py --- a/webmails/rainloop/start.py +++ b/webmails/rainloop/start.py @@ -10,6 +10,8 @@ os.environ["FRONT_ADDRESS"] = os.environ.get("FRONT_ADDRESS", "front") os.environ["IMAP_ADDRESS"] = os.environ.get("IMAP_ADDRESS", "imap") +os.environ["MAX_FILESIZE"] = str(int(int(os.environ.get("MESSAGE_SIZE_LIMIT"))*0.66/1048576)) + base = "/data/_data_/_default_/" shutil.rmtree(base + "domains/", ignore_errors=True) os.makedirs(base + "domains", exist_ok=True) @@ -17,6 +19,7 @@ convert("/default.ini", "/data/_data_/_default_/domains/default.ini") convert("/config.ini", "/data/_data_/_default_/configs/config.ini") +convert("/php.ini", "/usr/local/etc/php/conf.d/rainloop.ini") os.system("chown -R www-data:www-data /data") diff --git a/webmails/roundcube/start.py b/webmails/roundcube/start.py --- a/webmails/roundcube/start.py +++ b/webmails/roundcube/start.py @@ -1,6 +1,13 @@ #!/usr/bin/python3 import os +import jinja2 + +convert = lambda src, dst: open(dst, "w").write(jinja2.Template(open(src).read()).render(**os.environ)) + +os.environ["MAX_FILESIZE"] = str(int(int(os.environ.get("MESSAGE_SIZE_LIMIT"))*0.66/1048576)) + +convert("/php.ini", "/usr/local/etc/php/conf.d/roundcube.ini") # Fix some permissions os.system("mkdir -p /data/gpg")
Increase attachment size limit Hello, How can web change the max file limit of attachment in Roundcube ? Version 1.5
Currently you can't, you could mount a new ``php.ini`` with a different ``upload_max_filesize`` and ``post_max_size``. Ideally, you would need to generate a dynamic ``php.ini``. The best way to go is probably to create the same kind of ``start.py`` as for other containers and compile a ``php.ini`` that uses the max mail size environment variable. @ionutfilip
2018-12-07T11:42:54
Mailu/Mailu
737
Mailu__Mailu-737
[ "733" ]
74693ee47cbabb11f547975b4ba5bc4337229fa9
diff --git a/core/admin/mailu/models.py b/core/admin/mailu/models.py --- a/core/admin/mailu/models.py +++ b/core/admin/mailu/models.py @@ -426,7 +426,7 @@ def resolve(cls, localpart, domain_name): ) ) ) - ).first() + ).order_by(cls.wildcard, sqlalchemy.func.char_length(cls.localpart).desc()).first() class Token(Base):
Alias behaviour changed in master Hi, I tried the last master version (I don't know the version I was using before, it was probably 8 weeks old). With this version, the alias behavior has changed and it seems that catchall mailbox cannot be used anymore. Previously, the behavior was the one described by Kaiyou in issue #155 : > [..]it is not the first alias that matches but the longest (and hopefully most specific). This behaviour was inspired by pattern matching in other applications and seems to be the norm.owever, it is not the first alias that matches but the longest (and hopefully most specific). This behaviour was inspired by pattern matching in other applications and seems to be the norm. Now, it seems that the shortest alias is matched. Here is my config: name1.%@domain.tld -> [email protected] name2.%@domain.tld -> [email protected] %@domain.tld -> [email protected] Before the mail sent to [email protected] was delivered to mailbox [email protected], and all the mail that did not match (for example [email protected]) where delivered to [email protected]. Now every mail are delivered to the catchall mailbox.
2018-12-09T18:53:26
Mailu/Mailu
743
Mailu__Mailu-743
[ "738", "738" ]
5795d8be165b300c43f43d304f94df4790f4c9ae
diff --git a/core/admin/mailu/__init__.py b/core/admin/mailu/__init__.py --- a/core/admin/mailu/__init__.py +++ b/core/admin/mailu/__init__.py @@ -8,7 +8,6 @@ def create_app_from_config(config): """ Create a new application based on the given configuration """ app = flask.Flask(__name__) - app.app_context().push() app.cli.add_command(manage.mailu) # Bootstrap is used for basic JS and CSS loading diff --git a/core/admin/mailu/internal/views/auth.py b/core/admin/mailu/internal/views/auth.py --- a/core/admin/mailu/internal/views/auth.py +++ b/core/admin/mailu/internal/views/auth.py @@ -9,7 +9,7 @@ @internal.route("/auth/email") @utils.limiter.limit( - app.config["AUTH_RATELIMIT"], + lambda: app.config["AUTH_RATELIMIT"], lambda: flask.request.headers["Client-Ip"] ) def nginx_authentication():
Strange behavior of Admin UI login As discussed on Matrix. It seems that the login "failures" as noted in #670 are back. ## In short When doing a login on the admin UI, it happens from time to time that the login screen is presented once again. Looking in the logs, the `POST` is returned with a status `200` (success), instead of a `302` (redirect). This behavior is not consistent. Also, it seems that this behavior affects other `POST` requests, like creating a domain. It seems that the behavior exposes more in my production environment, 2 out 3 `POST` request don't work. This environment is on Docker Swarm, with a replicated front and a single Admin. `main.db` resides on a local file system. This might be due to the Docker env, network or the fact that the DB originated from a 1.5 installation. ## Reproduction I was able to reproduce this on a test server with docker-compose setup. However, the behavior expresses less frequent. (Perhaps 1 out of 5). On this environment it seems that it did not expose using a database created with the latest master, only with an updated database. Checkout a version from before the merge of #670. Build images, run mailu and setup the first user. ``` sudo rm -rfv /mailu git checkout fee52e87eddbf445b15359eea95cde576bc13666 export MAILU_VERSION="master" docker-compose -f tests/build.yml build cd <to compose file> docker-compose up -d docker-compose exec admin python3 manage.py admin admin usrpro.io Simple123 ``` At this stage I verified that login behaved "normal". I logged out and proceeded to update. ``` git checkout upstream/master docker-compose -f tests/build.yml build docker-compose up -d ``` Now, during log-in the behavior exposed as described above. Here are the admin container logs: ``` admin_1 | 188.27.138.94 - - [10/Dec/2018:12:49:53 +0000] "POST /ui/login?next=ui.index HTTP/1.0" 200 4395 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:05 +0000] "POST /ui/login?next=ui.index HTTP/1.0" 302 227 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:05 +0000] "GET /ui/ HTTP/1.0" 302 253 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:06 +0000] "GET /ui/user/settings HTTP/1.0" 200 7535 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 127.0.0.1 - - [10/Dec/2018:12:50:07 +0000] "GET /ui/login?next=ui.index HTTP/1.1" 200 4308 "-" "curl/7.61.1" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:09 +0000] "GET /ui/logout HTTP/1.0" 302 227 "https://mail.usrpro.io/admin/ui/user/settings" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:09 +0000] "GET /ui/ HTTP/1.0" 302 265 "https://mail.usrpro.io/admin/ui/user/settings" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:09 +0000] "GET /ui/login?next=ui.index HTTP/1.0" 200 4380 "https://mail.usrpro.io/admin/ui/user/settings" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:14 +0000] "POST /ui/login?next=ui.index HTTP/1.0" 200 4395 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:18 +0000] "POST /ui/login?next=ui.index HTTP/1.0" 302 227 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:18 +0000] "GET /ui/ HTTP/1.0" 302 253 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:19 +0000] "GET /ui/user/settings HTTP/1.0" 200 7535 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:20 +0000] "GET /ui/logout HTTP/1.0" 302 227 "https://mail.usrpro.io/admin/ui/user/settings" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:20 +0000] "GET /ui/ HTTP/1.0" 302 265 "https://mail.usrpro.io/admin/ui/user/settings" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:20 +0000] "GET /ui/login?next=ui.index HTTP/1.0" 200 4380 "https://mail.usrpro.io/admin/ui/user/settings" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:23 +0000] "POST /ui/login?next=ui.index HTTP/1.0" 302 227 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:23 +0000] "GET /ui/ HTTP/1.0" 302 253 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:23 +0000] "GET /ui/user/settings HTTP/1.0" 200 7535 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:25 +0000] "GET /ui/logout HTTP/1.0" 302 227 "https://mail.usrpro.io/admin/ui/user/settings" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:25 +0000] "GET /ui/ HTTP/1.0" 302 265 "https://mail.usrpro.io/admin/ui/user/settings" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:25 +0000] "GET /ui/login?next=ui.index HTTP/1.0" 200 4380 "https://mail.usrpro.io/admin/ui/user/settings" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:28 +0000] "POST /ui/login?next=ui.index HTTP/1.0" 302 227 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:28 +0000] "GET /ui/ HTTP/1.0" 302 253 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:28 +0000] "GET /ui/user/settings HTTP/1.0" 200 7535 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" ``` You can see that there are two POST requests that returned a 200. This where the ones where login did not work as supposed. All the other output are the succeeded attempts. Strange behavior of Admin UI login As discussed on Matrix. It seems that the login "failures" as noted in #670 are back. ## In short When doing a login on the admin UI, it happens from time to time that the login screen is presented once again. Looking in the logs, the `POST` is returned with a status `200` (success), instead of a `302` (redirect). This behavior is not consistent. Also, it seems that this behavior affects other `POST` requests, like creating a domain. It seems that the behavior exposes more in my production environment, 2 out 3 `POST` request don't work. This environment is on Docker Swarm, with a replicated front and a single Admin. `main.db` resides on a local file system. This might be due to the Docker env, network or the fact that the DB originated from a 1.5 installation. ## Reproduction I was able to reproduce this on a test server with docker-compose setup. However, the behavior expresses less frequent. (Perhaps 1 out of 5). On this environment it seems that it did not expose using a database created with the latest master, only with an updated database. Checkout a version from before the merge of #670. Build images, run mailu and setup the first user. ``` sudo rm -rfv /mailu git checkout fee52e87eddbf445b15359eea95cde576bc13666 export MAILU_VERSION="master" docker-compose -f tests/build.yml build cd <to compose file> docker-compose up -d docker-compose exec admin python3 manage.py admin admin usrpro.io Simple123 ``` At this stage I verified that login behaved "normal". I logged out and proceeded to update. ``` git checkout upstream/master docker-compose -f tests/build.yml build docker-compose up -d ``` Now, during log-in the behavior exposed as described above. Here are the admin container logs: ``` admin_1 | 188.27.138.94 - - [10/Dec/2018:12:49:53 +0000] "POST /ui/login?next=ui.index HTTP/1.0" 200 4395 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:05 +0000] "POST /ui/login?next=ui.index HTTP/1.0" 302 227 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:05 +0000] "GET /ui/ HTTP/1.0" 302 253 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:06 +0000] "GET /ui/user/settings HTTP/1.0" 200 7535 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 127.0.0.1 - - [10/Dec/2018:12:50:07 +0000] "GET /ui/login?next=ui.index HTTP/1.1" 200 4308 "-" "curl/7.61.1" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:09 +0000] "GET /ui/logout HTTP/1.0" 302 227 "https://mail.usrpro.io/admin/ui/user/settings" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:09 +0000] "GET /ui/ HTTP/1.0" 302 265 "https://mail.usrpro.io/admin/ui/user/settings" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:09 +0000] "GET /ui/login?next=ui.index HTTP/1.0" 200 4380 "https://mail.usrpro.io/admin/ui/user/settings" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:14 +0000] "POST /ui/login?next=ui.index HTTP/1.0" 200 4395 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:18 +0000] "POST /ui/login?next=ui.index HTTP/1.0" 302 227 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:18 +0000] "GET /ui/ HTTP/1.0" 302 253 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:19 +0000] "GET /ui/user/settings HTTP/1.0" 200 7535 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:20 +0000] "GET /ui/logout HTTP/1.0" 302 227 "https://mail.usrpro.io/admin/ui/user/settings" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:20 +0000] "GET /ui/ HTTP/1.0" 302 265 "https://mail.usrpro.io/admin/ui/user/settings" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:20 +0000] "GET /ui/login?next=ui.index HTTP/1.0" 200 4380 "https://mail.usrpro.io/admin/ui/user/settings" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:23 +0000] "POST /ui/login?next=ui.index HTTP/1.0" 302 227 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:23 +0000] "GET /ui/ HTTP/1.0" 302 253 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:23 +0000] "GET /ui/user/settings HTTP/1.0" 200 7535 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:25 +0000] "GET /ui/logout HTTP/1.0" 302 227 "https://mail.usrpro.io/admin/ui/user/settings" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:25 +0000] "GET /ui/ HTTP/1.0" 302 265 "https://mail.usrpro.io/admin/ui/user/settings" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:25 +0000] "GET /ui/login?next=ui.index HTTP/1.0" 200 4380 "https://mail.usrpro.io/admin/ui/user/settings" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:28 +0000] "POST /ui/login?next=ui.index HTTP/1.0" 302 227 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:28 +0000] "GET /ui/ HTTP/1.0" 302 253 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:12:50:28 +0000] "GET /ui/user/settings HTTP/1.0" 200 7535 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" ``` You can see that there are two POST requests that returned a 200. This where the ones where login did not work as supposed. All the other output are the succeeded attempts.
Database file from the test server: https://we.tl/t-sB4tAC4Dwd Compose and env files: https://gist.github.com/muhlemmer/8324938c6a23757b3150b4fde4fa14cd I did a fresh install of 1.5 and upgraded to latest master. This seems to trigger the behavior at the same frequency as I'm seeing in production! Logs don't tell much: ``` admin_1 | 188.27.138.94 - - [10/Dec/2018:14:48:30 +0000] "POST /ui/login?next=ui.index HTTP/1.0" 200 4395 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:14:48:34 +0000] "POST /ui/login?next=ui.index HTTP/1.0" 200 4395 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:14:48:37 +0000] "POST /ui/login?next=ui.index HTTP/1.0" 200 4395 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:14:48:39 +0000] "POST /ui/login?next=ui.index HTTP/1.0" 200 4395 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" ``` Basically I did: ``` sudo rm -rfv /mailu cd <to compose file for 1.5> docker-compose up -d docker-compose exec python manage.py admin admin usrpro.io Simple123 <Verify login> docker-compose down cd <to compose file for master> docker-compose up -d docker-compose logs -f admin ``` After waiting for things to settle, I tried login in. Couldn't login, even after 20x I could also reproduce this behavior, when I want to create an alias. I noticed it when testing #737 It seems very random and the logs only contains the following: ``` admin_1 | 172.21.0.1 - - [10/Dec/2018:15:25:22 +0000] "POST /ui/alias/create/example.com HTTP/1.0" 200 11960 "http://172.21.0.10/settings/ui/alias/create/example.com" "Mozilla/5.0 (X11; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" ``` Normally there is (as you mentioned) a 302 redirect after successfully creating an alias: ``` admin_1 | 172.21.0.1 - - [10/Dec/2018:15:22:35 +0000] "POST /ui/alias/create/example.com HTTP/1.0" 302 275 "http://172.21.0.10/settings/ui/alias/create/example.com" "Mozilla/5.0 (X11; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 172.21.0.1 - - [10/Dec/2018:15:22:35 +0000] "GET /ui/alias/list/example.com HTTP/1.0" 200 27473 "http://172.21.0.10/settings/ui/alias/create/example.com" "Mozilla/5.0 (X11; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" ``` I could pass it with smashing the "Save" button very often. Also the behavior with the login page happens sometimes on my dev environment. Finally got screen recording to work :laughing: . But I'm glad someone else can reproduce it. Almost started to worry it was the phase of the moon or something. https://youtu.be/KPCHoh6RtFU I cannot reproduce the issue so I am mostly fishing. Not everything sounds consistent with it but it could be an issue with csrf checks. Could you try setting ``WTF_CSRF_ENABLED=False`` in the app configuration.py (or ``__init__.py`` if you are running the latest commits)? Also, you mention the redirection failing. But in the case of an alias creation for instance, does the alias get created or does the whole create-then-redirect fail? The former would eliminate my first hypothesis while the latter woule make wtform checks, especially csrf, very probable culprits. Could you check from the browser that all post requests, including the failing ones, contain a valid session cookie and the hidden csrf token as part of the submitted form? Also, I am assuming there is no significant delay between displaying the page that contains the form and posting the form itself (meaning << 1 hour). Is that assumption correct? So, one advancement. At one point login succeeded and I was not able to reproduce. After getting rid of the session cooky in my browser, this behavior came back. No new cookies are received at any point, even after a number of tried logins. ![image](https://user-images.githubusercontent.com/5411563/49812230-a36ea480-fd6d-11e8-8fd5-d2b12c70e805.png) Recap: 1. I deployed mailu:1.5, with `SECRET_KEY` still set to "ChangeMeChangeMe" 2. I did `docker-compose down` 3. I deployed mailu:master, with `SECRET_KEY` set to a random string (from setup) 4. Delete all cookies 5. Can't login Small note, after changing `SECRET_KEY` to "ChangeMeChangeMe" in master's mailu.env, docker-compose down & up, I could login again. However, my colleague somehow still can't :roll_eyes: Deleting the cookie again on my side continued the behavior. I'll continue with your suggestions now, csrf token is set in the form. ![image](https://user-images.githubusercontent.com/5411563/49813710-b171f480-fd70-11e8-8a9e-fe3a9d55ae72.png) csrf is actually set twice to the same value: ![image](https://user-images.githubusercontent.com/5411563/49814565-8c7e8100-fd72-11e8-9f79-f712cd5e1209.png) Setting `'WTF_CSRF_ENABLED': 'False',` as entry of `DEFAULT_CONFIG` did not change the behavior. And crsf tokens are still present in the form. > Also, you mention the redirection failing. But in the case of an alias creation for instance, does the alias get created or does the whole create-then-redirect fail? The former would eliminate my first hypothesis while the latter woule make wtform checks, especially csrf, very probable culprits. As a matter of fact, we first cam across this problem in our psql branch. Because I though we did something wrong, I enable full verbosity on the database logs, allowing us to see what's happening. I'll cite my comment from the PR: > It might be very interesting to know, that looking at the postresql logs, no log-in queries are executed in cases where it didn't work. The only query that does get executed, is the one that lists the sign-up domains. On my setup, the issue disappears if I set WEBROOT_REDIRECT=/admin > On my setup, the issue disappears if I set WEBROOT_REDIRECT=/admin @ofthesun9 You are sure its because of the env variable? Because for me the issue disappear for a while, when I just doing `docker-compose down` and `docker-compose up -d`. > But in the case of an alias creation for instance, does the alias get created or does the whole create-then-redirect fail? The alias doesn't get created. Only after clicking the `Save` button several times, the page is redirected and the alias created. @hoellen I just set the WEBROOT_REDIRECT=/admin - login was ok right first time. - creation of an alias was ok. Now, the other way around :-) I just set WEBROOT_REDIRECT=/webmail docker-compose up -d - login was ok at the 4th attempt - creation of an alias was ok at the 8th attempt @ofthesun9: Changing `WEBROOT_REDIRECT` did not make any difference on my test server ;) @kaiyou: I've been able to reproduce it more simply now: 1. Install a new Mailu deployment from master, create the first user 2. Browse to the admin login page. Observe a session cookie is obtained 3. Login, it works. 4. Logout and manually delete the session cookie 5. Refresh the page, no new session cookie is send 6. Try to login, it won't work. I don't believe we are managing the cookies directly in our app? I start to suspect flask-login to have a bug. I believe this was updated also in the admin refactor. It seem to be CSRF tokens issues. We've modified the `/login' view: ``` @ui.route('/login', methods=['GET', 'POST']) def login(): print(">>>>> Login route called",file=sys.stderr,flush=True) form = forms.LoginForm() print(request.form,file=sys.stderr,flush=True) if form.validate_on_submit(): print(">>>>> Submit validated",file=sys.stderr,flush=True) user = models.User.login(form.email.data, form.pw.data) if user: print(">>>>> Calling flask login",file=sys.stderr,flush=True) print(user,file=sys.stderr,flush=True) flask_login.login_user(user) endpoint = flask.request.args.get('next', '.index') r = flask.redirect(flask.url_for(endpoint) or flask.url_for('.index')) print(">>>>> Return will be:",file=sys.stderr,flush=True) print(r,file=sys.stderr,flush=True) return r else: flask.flash('Wrong e-mail or password', 'error') for f, eM in form.errors.items(): for e in eM: print(e,file=sys.stderr,flush=True) return flask.render_template('login.html', form=form) ``` This is giving us the following logs: ``` admin_1 | >>>>> Login route called admin_1 | ImmutableMultiDict([('csrf_token', 'IjllYmQxM2E4YjM4OTk3NzQ5OGIzMWI0NzIxNzZhOWQ0MDI4NTA1MWIi.XBDWOw._cAQl6sf9TmkJRLVVoFmotalMJU'), ('csrf_token', 'IjllYmQxM2E4YjM4OTk3NzQ5OGIzMWI0NzIxNzZhOWQ0MDI4NTA1MWIi.XBDWOw._cAQl6sf9TmkJRLVVoFmotalMJU'), ('email', '[email protected]'), ('pw', 'Simple123'), ('submit', 'Sign in')]) admin_1 | The CSRF session token is missing. admin_1 | 188.27.138.94 - - [12/Dec/2018:09:34:57 +0000] "POST /ui/login?next=ui.index HTTP/1.0" 200 4395 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" ``` Sometimes a cookie gets passed back to the browser. (Usually the first time after restarting the container). The request that return the cookie looks like: ``` >>>>> Login route called admin_1 | ImmutableMultiDict([('csrf_token', 'IjdjMjQwNGQ0MzcwNGM4MDYzNWEzYmRkOWM3NDQ0Y2VjMjVmYjdhY2Qi.XBDXqg.-jUYkwM2pOliQQjXqdJEGFv7d_0'), ('csrf_token', 'IjdjMjQwNGQ0MzcwNGM4MDYzNWEzYmRkOWM3NDQ0Y2VjMjVmYjdhY2Qi.XBDXqg.-jUYkwM2pOliQQjXqdJEGFv7d_0'), ('email', '[email protected]'), ('pw', 'Simple123'), ('submit', 'Sign in')]) admin_1 | The CSRF tokens do not match. admin_1 | 188.27.138.94 - - [12/Dec/2018:09:47:49 +0000] "POST /ui/login?next=ui.index HTTP/1.0" 200 4395 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" ``` So now the mis-match gave us a session cookie. Subsequently, we can now login: ``` >>>>> Login route called admin_1 | ImmutableMultiDict([('csrf_token', 'ImZlNTJhNDhiOGFmY2UxNzA3ZDU0MTVmMDY2ODQ4NDQ2ZmFiNTE0NzYi.XBDZRA.AV8TIGthmaVZthN_UofCCYFKvtY'), ('csrf_token', 'ImZlNTJhNDhiOGFmY2UxNzA3ZDU0MTVmMDY2ODQ4NDQ2ZmFiNTE0NzYi.XBDZRA.AV8TIGthmaVZthN_UofCCYFKvtY'), ('email', '[email protected]'), ('pw', 'Simple123'), ('submit', 'Sign in')]) admin_1 | >>>>> Submit validated admin_1 | >>>>> Calling flask login admin_1 | [email protected] admin_1 | >>>>> Return will be: admin_1 | <Response 227 bytes [302 FOUND]> admin_1 | 188.27.138.94 - - [12/Dec/2018:09:51:23 +0000] "POST /ui/login?next=ui.index HTTP/1.0" 302 227 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [12/Dec/2018:09:51:23 +0000] "GET /ui/ HTTP/1.0" 302 253 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [12/Dec/2018:09:51:24 +0000] "GET /ui/user/settings HTTP/1.0" 200 7535 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" ``` So now I logged out and deleted the cookie again. Browsing to the admin page (GET): ``` admin_1 | 188.27.138.94 - - [12/Dec/2018:09:55:02 +0000] "GET /ui/ HTTP/1.0" 302 265 "-" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | >>>>> Login route called admin_1 | ImmutableMultiDict([]) admin_1 | 188.27.138.94 - - [12/Dec/2018:09:55:02 +0000] "GET /ui/login?next=ui.index HTTP/1.0" 200 4380 "-" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [12/Dec/2018:09:55:03 +0000] "GET /static/bootstrap/css/bootstrap.min.css.map HTTP/1.0" 404 233 "-" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" ``` No form errors, but also no cookie. @kaiyou: So we're giving up for the day. We are going on a small business trip tomorrow, so that's a bit inconvenient. If you don't find anything useful tonight, we might need to disable CSRF on master for the time being? We have quite some injected code in https://github.com/usrpro/Mailu/tree/trouble. Maybe you want to reuse it. It includes the following: 1. Some print statements to see code flow 2. Middleware that dumps the request and response headers 3. An direct call to `flask_wtf` to regenerate the token 4. `flask.session.permanent = True` 5. Print the contents of session. We can see now, with setting of (4) a cookie is always send. Perfect. Put the cookie does not contain the CSRF token.... Somehow flask_wtf is not appending it to session. Not even when calling directly. There are quite some changes to the flask session and cookie interface, but I could find anything apparent there either, but maybe it broke something in flask_wtf, which has not been updated after the release of flask 1.0? http://flask.pocoo.org/docs/1.0/changelog/#version-1-0 Database file from the test server: https://we.tl/t-sB4tAC4Dwd Compose and env files: https://gist.github.com/muhlemmer/8324938c6a23757b3150b4fde4fa14cd I did a fresh install of 1.5 and upgraded to latest master. This seems to trigger the behavior at the same frequency as I'm seeing in production! Logs don't tell much: ``` admin_1 | 188.27.138.94 - - [10/Dec/2018:14:48:30 +0000] "POST /ui/login?next=ui.index HTTP/1.0" 200 4395 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:14:48:34 +0000] "POST /ui/login?next=ui.index HTTP/1.0" 200 4395 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:14:48:37 +0000] "POST /ui/login?next=ui.index HTTP/1.0" 200 4395 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [10/Dec/2018:14:48:39 +0000] "POST /ui/login?next=ui.index HTTP/1.0" 200 4395 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" ``` Basically I did: ``` sudo rm -rfv /mailu cd <to compose file for 1.5> docker-compose up -d docker-compose exec python manage.py admin admin usrpro.io Simple123 <Verify login> docker-compose down cd <to compose file for master> docker-compose up -d docker-compose logs -f admin ``` After waiting for things to settle, I tried login in. Couldn't login, even after 20x I could also reproduce this behavior, when I want to create an alias. I noticed it when testing #737 It seems very random and the logs only contains the following: ``` admin_1 | 172.21.0.1 - - [10/Dec/2018:15:25:22 +0000] "POST /ui/alias/create/example.com HTTP/1.0" 200 11960 "http://172.21.0.10/settings/ui/alias/create/example.com" "Mozilla/5.0 (X11; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" ``` Normally there is (as you mentioned) a 302 redirect after successfully creating an alias: ``` admin_1 | 172.21.0.1 - - [10/Dec/2018:15:22:35 +0000] "POST /ui/alias/create/example.com HTTP/1.0" 302 275 "http://172.21.0.10/settings/ui/alias/create/example.com" "Mozilla/5.0 (X11; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 172.21.0.1 - - [10/Dec/2018:15:22:35 +0000] "GET /ui/alias/list/example.com HTTP/1.0" 200 27473 "http://172.21.0.10/settings/ui/alias/create/example.com" "Mozilla/5.0 (X11; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" ``` I could pass it with smashing the "Save" button very often. Also the behavior with the login page happens sometimes on my dev environment. Finally got screen recording to work :laughing: . But I'm glad someone else can reproduce it. Almost started to worry it was the phase of the moon or something. https://youtu.be/KPCHoh6RtFU I cannot reproduce the issue so I am mostly fishing. Not everything sounds consistent with it but it could be an issue with csrf checks. Could you try setting ``WTF_CSRF_ENABLED=False`` in the app configuration.py (or ``__init__.py`` if you are running the latest commits)? Also, you mention the redirection failing. But in the case of an alias creation for instance, does the alias get created or does the whole create-then-redirect fail? The former would eliminate my first hypothesis while the latter woule make wtform checks, especially csrf, very probable culprits. Could you check from the browser that all post requests, including the failing ones, contain a valid session cookie and the hidden csrf token as part of the submitted form? Also, I am assuming there is no significant delay between displaying the page that contains the form and posting the form itself (meaning << 1 hour). Is that assumption correct? So, one advancement. At one point login succeeded and I was not able to reproduce. After getting rid of the session cooky in my browser, this behavior came back. No new cookies are received at any point, even after a number of tried logins. ![image](https://user-images.githubusercontent.com/5411563/49812230-a36ea480-fd6d-11e8-8fd5-d2b12c70e805.png) Recap: 1. I deployed mailu:1.5, with `SECRET_KEY` still set to "ChangeMeChangeMe" 2. I did `docker-compose down` 3. I deployed mailu:master, with `SECRET_KEY` set to a random string (from setup) 4. Delete all cookies 5. Can't login Small note, after changing `SECRET_KEY` to "ChangeMeChangeMe" in master's mailu.env, docker-compose down & up, I could login again. However, my colleague somehow still can't :roll_eyes: Deleting the cookie again on my side continued the behavior. I'll continue with your suggestions now, csrf token is set in the form. ![image](https://user-images.githubusercontent.com/5411563/49813710-b171f480-fd70-11e8-8a9e-fe3a9d55ae72.png) csrf is actually set twice to the same value: ![image](https://user-images.githubusercontent.com/5411563/49814565-8c7e8100-fd72-11e8-9f79-f712cd5e1209.png) Setting `'WTF_CSRF_ENABLED': 'False',` as entry of `DEFAULT_CONFIG` did not change the behavior. And crsf tokens are still present in the form. > Also, you mention the redirection failing. But in the case of an alias creation for instance, does the alias get created or does the whole create-then-redirect fail? The former would eliminate my first hypothesis while the latter woule make wtform checks, especially csrf, very probable culprits. As a matter of fact, we first cam across this problem in our psql branch. Because I though we did something wrong, I enable full verbosity on the database logs, allowing us to see what's happening. I'll cite my comment from the PR: > It might be very interesting to know, that looking at the postresql logs, no log-in queries are executed in cases where it didn't work. The only query that does get executed, is the one that lists the sign-up domains. On my setup, the issue disappears if I set WEBROOT_REDIRECT=/admin > On my setup, the issue disappears if I set WEBROOT_REDIRECT=/admin @ofthesun9 You are sure its because of the env variable? Because for me the issue disappear for a while, when I just doing `docker-compose down` and `docker-compose up -d`. > But in the case of an alias creation for instance, does the alias get created or does the whole create-then-redirect fail? The alias doesn't get created. Only after clicking the `Save` button several times, the page is redirected and the alias created. @hoellen I just set the WEBROOT_REDIRECT=/admin - login was ok right first time. - creation of an alias was ok. Now, the other way around :-) I just set WEBROOT_REDIRECT=/webmail docker-compose up -d - login was ok at the 4th attempt - creation of an alias was ok at the 8th attempt @ofthesun9: Changing `WEBROOT_REDIRECT` did not make any difference on my test server ;) @kaiyou: I've been able to reproduce it more simply now: 1. Install a new Mailu deployment from master, create the first user 2. Browse to the admin login page. Observe a session cookie is obtained 3. Login, it works. 4. Logout and manually delete the session cookie 5. Refresh the page, no new session cookie is send 6. Try to login, it won't work. I don't believe we are managing the cookies directly in our app? I start to suspect flask-login to have a bug. I believe this was updated also in the admin refactor. It seem to be CSRF tokens issues. We've modified the `/login' view: ``` @ui.route('/login', methods=['GET', 'POST']) def login(): print(">>>>> Login route called",file=sys.stderr,flush=True) form = forms.LoginForm() print(request.form,file=sys.stderr,flush=True) if form.validate_on_submit(): print(">>>>> Submit validated",file=sys.stderr,flush=True) user = models.User.login(form.email.data, form.pw.data) if user: print(">>>>> Calling flask login",file=sys.stderr,flush=True) print(user,file=sys.stderr,flush=True) flask_login.login_user(user) endpoint = flask.request.args.get('next', '.index') r = flask.redirect(flask.url_for(endpoint) or flask.url_for('.index')) print(">>>>> Return will be:",file=sys.stderr,flush=True) print(r,file=sys.stderr,flush=True) return r else: flask.flash('Wrong e-mail or password', 'error') for f, eM in form.errors.items(): for e in eM: print(e,file=sys.stderr,flush=True) return flask.render_template('login.html', form=form) ``` This is giving us the following logs: ``` admin_1 | >>>>> Login route called admin_1 | ImmutableMultiDict([('csrf_token', 'IjllYmQxM2E4YjM4OTk3NzQ5OGIzMWI0NzIxNzZhOWQ0MDI4NTA1MWIi.XBDWOw._cAQl6sf9TmkJRLVVoFmotalMJU'), ('csrf_token', 'IjllYmQxM2E4YjM4OTk3NzQ5OGIzMWI0NzIxNzZhOWQ0MDI4NTA1MWIi.XBDWOw._cAQl6sf9TmkJRLVVoFmotalMJU'), ('email', '[email protected]'), ('pw', 'Simple123'), ('submit', 'Sign in')]) admin_1 | The CSRF session token is missing. admin_1 | 188.27.138.94 - - [12/Dec/2018:09:34:57 +0000] "POST /ui/login?next=ui.index HTTP/1.0" 200 4395 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" ``` Sometimes a cookie gets passed back to the browser. (Usually the first time after restarting the container). The request that return the cookie looks like: ``` >>>>> Login route called admin_1 | ImmutableMultiDict([('csrf_token', 'IjdjMjQwNGQ0MzcwNGM4MDYzNWEzYmRkOWM3NDQ0Y2VjMjVmYjdhY2Qi.XBDXqg.-jUYkwM2pOliQQjXqdJEGFv7d_0'), ('csrf_token', 'IjdjMjQwNGQ0MzcwNGM4MDYzNWEzYmRkOWM3NDQ0Y2VjMjVmYjdhY2Qi.XBDXqg.-jUYkwM2pOliQQjXqdJEGFv7d_0'), ('email', '[email protected]'), ('pw', 'Simple123'), ('submit', 'Sign in')]) admin_1 | The CSRF tokens do not match. admin_1 | 188.27.138.94 - - [12/Dec/2018:09:47:49 +0000] "POST /ui/login?next=ui.index HTTP/1.0" 200 4395 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" ``` So now the mis-match gave us a session cookie. Subsequently, we can now login: ``` >>>>> Login route called admin_1 | ImmutableMultiDict([('csrf_token', 'ImZlNTJhNDhiOGFmY2UxNzA3ZDU0MTVmMDY2ODQ4NDQ2ZmFiNTE0NzYi.XBDZRA.AV8TIGthmaVZthN_UofCCYFKvtY'), ('csrf_token', 'ImZlNTJhNDhiOGFmY2UxNzA3ZDU0MTVmMDY2ODQ4NDQ2ZmFiNTE0NzYi.XBDZRA.AV8TIGthmaVZthN_UofCCYFKvtY'), ('email', '[email protected]'), ('pw', 'Simple123'), ('submit', 'Sign in')]) admin_1 | >>>>> Submit validated admin_1 | >>>>> Calling flask login admin_1 | [email protected] admin_1 | >>>>> Return will be: admin_1 | <Response 227 bytes [302 FOUND]> admin_1 | 188.27.138.94 - - [12/Dec/2018:09:51:23 +0000] "POST /ui/login?next=ui.index HTTP/1.0" 302 227 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [12/Dec/2018:09:51:23 +0000] "GET /ui/ HTTP/1.0" 302 253 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [12/Dec/2018:09:51:24 +0000] "GET /ui/user/settings HTTP/1.0" 200 7535 "https://mail.usrpro.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" ``` So now I logged out and deleted the cookie again. Browsing to the admin page (GET): ``` admin_1 | 188.27.138.94 - - [12/Dec/2018:09:55:02 +0000] "GET /ui/ HTTP/1.0" 302 265 "-" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | >>>>> Login route called admin_1 | ImmutableMultiDict([]) admin_1 | 188.27.138.94 - - [12/Dec/2018:09:55:02 +0000] "GET /ui/login?next=ui.index HTTP/1.0" 200 4380 "-" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" admin_1 | 188.27.138.94 - - [12/Dec/2018:09:55:03 +0000] "GET /static/bootstrap/css/bootstrap.min.css.map HTTP/1.0" 404 233 "-" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0" ``` No form errors, but also no cookie. @kaiyou: So we're giving up for the day. We are going on a small business trip tomorrow, so that's a bit inconvenient. If you don't find anything useful tonight, we might need to disable CSRF on master for the time being? We have quite some injected code in https://github.com/usrpro/Mailu/tree/trouble. Maybe you want to reuse it. It includes the following: 1. Some print statements to see code flow 2. Middleware that dumps the request and response headers 3. An direct call to `flask_wtf` to regenerate the token 4. `flask.session.permanent = True` 5. Print the contents of session. We can see now, with setting of (4) a cookie is always send. Perfect. Put the cookie does not contain the CSRF token.... Somehow flask_wtf is not appending it to session. Not even when calling directly. There are quite some changes to the flask session and cookie interface, but I could find anything apparent there either, but maybe it broke something in flask_wtf, which has not been updated after the release of flask 1.0? http://flask.pocoo.org/docs/1.0/changelog/#version-1-0
2018-12-13T13:36:20
Mailu/Mailu
744
Mailu__Mailu-744
[ "720" ]
0f4ba3914172b019119b90ce36e88519a92afddc
diff --git a/core/admin/mailu/internal/views/dovecot.py b/core/admin/mailu/internal/views/dovecot.py --- a/core/admin/mailu/internal/views/dovecot.py +++ b/core/admin/mailu/internal/views/dovecot.py @@ -13,7 +13,6 @@ def dovecot_passdb_dict(user_email): allow_nets.append(app.config["SUBNET"]) if app.config["POD_ADDRESS_RANGE"]: allow_nets.append(app.config["POD_ADDRESS_RANGE"]) - print(allow_nets) return flask.jsonify({ "password": None, "nopassword": "Y",
Why a print statement in this code? @kaiyou, according git blame this is yours. I wonder if it was included for debugging purposes and not taken out anymore? https://github.com/Mailu/Mailu/blob/5c2439011413a114c470862f95206f8487fa4568/core/admin/mailu/internal/views/dovecot.py#L18
2018-12-13T14:23:32
Mailu/Mailu
764
Mailu__Mailu-764
[ "754" ]
be7dc1e6bd122c783805d1c647d9ceb03887b595
diff --git a/core/admin/mailu/ui/forms.py b/core/admin/mailu/ui/forms.py --- a/core/admin/mailu/ui/forms.py +++ b/core/admin/mailu/ui/forms.py @@ -136,7 +136,7 @@ class TokenForm(flask_wtf.FlaskForm): class AliasForm(flask_wtf.FlaskForm): - localpart = fields.StringField(_('Alias'), [validators.DataRequired()]) + localpart = fields.StringField(_('Alias'), [validators.DataRequired(), validators.Regexp(LOCALPART_REGEX)]) wildcard = fields.BooleanField( _('Use SQL LIKE Syntax (e.g. for catch-all aliases)')) destination = DestinationField(_('Destination'))
Accidentally specify a complete mail in the alias field โ‡’ oops When accidentally writing a complete email-address, like `[email protected]` into the mail-domainโ‡’aliasโ‡’create aliasโ‡’alias field, `admin` explodes like this, and the user is presented with a `500`: ``` admin_1_ef8e5e126497 | [2018-12-17 20:08:12,886] ERROR in app: Exception on /ui/alias/create/ram.en.it [POST] admin_1_ef8e5e126497 | Traceback (most recent call last): admin_1_ef8e5e126497 | File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1193, in _execute_context admin_1_ef8e5e126497 | context) admin_1_ef8e5e126497 | File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 509, in do_execute admin_1_ef8e5e126497 | cursor.execute(statement, parameters) admin_1_ef8e5e126497 | sqlite3.IntegrityError: NOT NULL constraint failed: alias.email admin_1_ef8e5e126497 | admin_1_ef8e5e126497 | The above exception was the direct cause of the following exception: admin_1_ef8e5e126497 | admin_1_ef8e5e126497 | Traceback (most recent call last): admin_1_ef8e5e126497 | File "/usr/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app admin_1_ef8e5e126497 | response = self.full_dispatch_request() admin_1_ef8e5e126497 | File "/usr/lib/python3.6/site-packages/flask/app.py", line 1815, in full_dispatch_request admin_1_ef8e5e126497 | rv = self.handle_user_exception(e) admin_1_ef8e5e126497 | File "/usr/lib/python3.6/site-packages/flask/app.py", line 1718, in handle_user_exception admin_1_ef8e5e126497 | reraise(exc_type, exc_value, tb) admin_1_ef8e5e126497 | File "/usr/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise admin_1_ef8e5e126497 | raise value admin_1_ef8e5e126497 | File "/usr/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request admin_1_ef8e5e126497 | rv = self.dispatch_request() admin_1_ef8e5e126497 | File "/usr/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request admin_1_ef8e5e126497 | return self.view_functions[rule.endpoint](**req.view_args) admin_1_ef8e5e126497 | File "/usr/lib/python3.6/site-packages/flask_login/utils.py", line 261, in decorated_view admin_1_ef8e5e126497 | return func(*args, **kwargs) admin_1_ef8e5e126497 | File "/app/mailu/ui/access.py", line 28, in wrapper admin_1_ef8e5e126497 | return callback(function, args, kwargs, dargs, dkwargs) admin_1_ef8e5e126497 | File "/app/mailu/ui/access.py", line 19, in callback admin_1_ef8e5e126497 | return function(*args, **kwargs) admin_1_ef8e5e126497 | File "/app/mailu/ui/views/aliases.py", line 31, in alias_create admin_1_ef8e5e126497 | models.db.session.commit() admin_1_ef8e5e126497 | File "/usr/lib/python3.6/site-packages/sqlalchemy/orm/scoping.py", line 153, in do admin_1_ef8e5e126497 | return getattr(self.registry(), name)(*args, **kwargs) admin_1_ef8e5e126497 | File "/usr/lib/python3.6/site-packages/sqlalchemy/orm/session.py", line 943, in commit admin_1_ef8e5e126497 | self.transaction.commit() admin_1_ef8e5e126497 | File "/usr/lib/python3.6/site-packages/sqlalchemy/orm/session.py", line 467, in commit admin_1_ef8e5e126497 | self._prepare_impl() admin_1_ef8e5e126497 | File "/usr/lib/python3.6/site-packages/sqlalchemy/orm/session.py", line 447, in _prepare_impl admin_1_ef8e5e126497 | self.session.flush() admin_1_ef8e5e126497 | File "/usr/lib/python3.6/site-packages/sqlalchemy/orm/session.py", line 2254, in flush admin_1_ef8e5e126497 | self._flush(objects) admin_1_ef8e5e126497 | File "/usr/lib/python3.6/site-packages/sqlalchemy/orm/session.py", line 2381, in _flush admin_1_ef8e5e126497 | transaction.rollback(_capture_exception=True) admin_1_ef8e5e126497 | File "/usr/lib/python3.6/site-packages/sqlalchemy/util/langhelpers.py", line 66, in __exit__ admin_1_ef8e5e126497 | compat.reraise(exc_type, exc_value, exc_tb) admin_1_ef8e5e126497 | File "/usr/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 249, in reraise admin_1_ef8e5e126497 | raise value admin_1_ef8e5e126497 | File "/usr/lib/python3.6/site-packages/sqlalchemy/orm/session.py", line 2345, in _flush admin_1_ef8e5e126497 | flush_context.execute() admin_1_ef8e5e126497 | File "/usr/lib/python3.6/site-packages/sqlalchemy/orm/unitofwork.py", line 395, in execute admin_1_ef8e5e126497 | rec.execute(self) admin_1_ef8e5e126497 | File "/usr/lib/python3.6/site-packages/sqlalchemy/orm/unitofwork.py", line 560, in execute admin_1_ef8e5e126497 | uow admin_1_ef8e5e126497 | File "/usr/lib/python3.6/site-packages/sqlalchemy/orm/persistence.py", line 181, in save_obj admin_1_ef8e5e126497 | mapper, table, insert) admin_1_ef8e5e126497 | File "/usr/lib/python3.6/site-packages/sqlalchemy/orm/persistence.py", line 866, in _emit_insert_statements admin_1_ef8e5e126497 | execute(statement, params) admin_1_ef8e5e126497 | File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 948, in execute admin_1_ef8e5e126497 | return meth(self, multiparams, params) admin_1_ef8e5e126497 | File "/usr/lib/python3.6/site-packages/sqlalchemy/sql/elements.py", line 269, in _execute_on_connection admin_1_ef8e5e126497 | return connection._execute_clauseelement(self, multiparams, params) admin_1_ef8e5e126497 | File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1060, in _execute_clauseelement admin_1_ef8e5e126497 | compiled_sql, distilled_params admin_1_ef8e5e126497 | File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1200, in _execute_context admin_1_ef8e5e126497 | context) admin_1_ef8e5e126497 | File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1413, in _handle_dbapi_exception admin_1_ef8e5e126497 | exc_info admin_1_ef8e5e126497 | File "/usr/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 265, in raise_from_cause admin_1_ef8e5e126497 | reraise(type(exception), exception, tb=exc_tb, cause=cause) admin_1_ef8e5e126497 | File "/usr/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 248, in reraise admin_1_ef8e5e126497 | raise value.with_traceback(tb) admin_1_ef8e5e126497 | File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1193, in _execute_context admin_1_ef8e5e126497 | context) admin_1_ef8e5e126497 | File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 509, in do_execute admin_1_ef8e5e126497 | cursor.execute(statement, parameters) admin_1_ef8e5e126497 | sqlalchemy.exc.IntegrityError: (sqlite3.IntegrityError) NOT NULL constraint failed: alias.email [SQL: 'INSERT INTO alias (created_at, updated_at, comment, localpart, wildcard, destination, domain_name, email) VALUES (?, ?, ?, ?, ?, ?, ?, ?)'] [parameters: ('2018-12-17', None, '', '[email protected]', 0, '[email protected]', 'ram.en.it', None)] (Background on this error at: http://sqlalche.me/e/gkpj) admin_1_ef8e5e126497 | 172.31.0.13 - - [17/Dec/2018:20:08:12 +0000] "POST /ui/alias/create/ram.en.it HTTP/1.0" 500 291 "https://mail.ram.en.it/admin/ui/alias/create/ram.en.it" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.80 Safari/537.36" ``` This is not bad, as no invalid/broken entry seems to be created, but i think itโ€™s an easy validation check so the user could be presented with a nicer and informative error โ€ฆ. Thanks everyone ^_^.
2018-12-19T09:57:02
Mailu/Mailu
769
Mailu__Mailu-769
[ "762" ]
d483ef3c2a1df250eec6b9457f2270735f0bc909
diff --git a/setup/server.py b/setup/server.py --- a/setup/server.py +++ b/setup/server.py @@ -10,7 +10,9 @@ import ipaddress -app = flask.Flask(__name__) +version = os.getenv("this_version") +static_url_path = "/" + version + "/static" +app = flask.Flask(__name__, static_url_path=static_url_path) flask_bootstrap.Bootstrap(app) db = redis.StrictRedis(host='redis', port=6379, db=0) @@ -40,29 +42,37 @@ def build_app(path): def app_context(): return dict(versions=os.getenv("VERSIONS","master").split(',')) - version = os.getenv("this_version") + prefix_bp = flask.Blueprint(version, __name__) + prefix_bp.jinja_loader = jinja2.ChoiceLoader([ + jinja2.FileSystemLoader(os.path.join(path, "templates")), + jinja2.FileSystemLoader(os.path.join(path, "flavors")) + ]) - bp = flask.Blueprint(version, __name__) - bp.jinja_loader = jinja2.ChoiceLoader([ + root_bp = flask.Blueprint("root", __name__) + root_bp.jinja_loader = jinja2.ChoiceLoader([ jinja2.FileSystemLoader(os.path.join(path, "templates")), jinja2.FileSystemLoader(os.path.join(path, "flavors")) ]) - @bp.context_processor + @prefix_bp.context_processor + @root_bp.context_processor def bp_context(version=version): return dict(version=version) - @bp.route("/") + @prefix_bp.route("/") + @root_bp.route("/") def wizard(): return flask.render_template('wizard.html') - @bp.route("/submit_flavor", methods=["POST"]) + @prefix_bp.route("/submit_flavor", methods=["POST"]) + @root_bp.route("/submit_flavor", methods=["POST"]) def submit_flavor(): data = flask.request.form.copy() steps = sorted(os.listdir(os.path.join(path, "templates", "steps", data["flavor"]))) return flask.render_template('wizard.html', flavor=data["flavor"], steps=steps) - @bp.route("/submit", methods=["POST"]) + @prefix_bp.route("/submit", methods=["POST"]) + @root_bp.route("/submit", methods=["POST"]) def submit(): data = flask.request.form.copy() data['uid'] = str(uuid.uuid4()) @@ -70,14 +80,16 @@ def submit(): db.set(data['uid'], json.dumps(data)) return flask.redirect(flask.url_for('.setup', uid=data['uid'])) - @bp.route("/setup/<uid>", methods=["GET"]) + @prefix_bp.route("/setup/<uid>", methods=["GET"]) + @root_bp.route("/setup/<uid>", methods=["GET"]) def setup(uid): data = json.loads(db.get(uid)) flavor = data.get("flavor", "compose") rendered = render_flavor(flavor, "setup.html", data) return flask.render_template("setup.html", contents=rendered) - @bp.route("/file/<uid>/<filepath>", methods=["GET"]) + @prefix_bp.route("/file/<uid>/<filepath>", methods=["GET"]) + @root_bp.route("/file/<uid>/<filepath>", methods=["GET"]) def file(uid, filepath): data = json.loads(db.get(uid)) flavor = data.get("flavor", "compose") @@ -86,7 +98,8 @@ def file(uid, filepath): mimetype="application/text" ) - app.register_blueprint(bp, url_prefix="/{}".format(version)) + app.register_blueprint(prefix_bp, url_prefix="/{}".format(version)) + app.register_blueprint(root_bp) if __name__ == "__main__":
Setup: generated files missing Traefik is ending up in a looped redirect when trying to download the generated files. Flask blueprint context to be modified to simplify the forwarding and eliminate the need for redirects.
2018-12-20T16:45:49
Mailu/Mailu
778
Mailu__Mailu-778
[ "755" ]
19df86f13f75dd7899e5ee6dc07fb6f23ec2434c
diff --git a/core/admin/mailu/models.py b/core/admin/mailu/models.py --- a/core/admin/mailu/models.py +++ b/core/admin/mailu/models.py @@ -260,10 +260,19 @@ def resolve_domain(cls, email): @classmethod def resolve_destination(cls, localpart, domain_name, ignore_forward_keep=False): + localpart_stripped = None + if os.environ.get('RECIPIENT_DELIMITER') in localpart: + localpart_stripped = localpart.rsplit(os.environ.get('RECIPIENT_DELIMITER'), 1)[0] + alias = Alias.resolve(localpart, domain_name) + if not alias and localpart_stripped: + alias = Alias.resolve(localpart_stripped, domain_name) if alias: return alias.destination + user = User.query.get('{}@{}'.format(localpart, domain_name)) + if not user and localpart_stripped: + user = User.query.get('{}@{}'.format(localpart_stripped, domain_name)) if user: if user.forward_enabled: destination = user.forward_destination
recipient_delimiter no longer working We've found that that `recipient_delimiter` is no longer working. It stopped functioning somewhere around two weeks ago, after we migrated our production server from 1.5 to master. We don't really have time to research this right now, so I'm opening an issue instead. In `mailu.env` is set: ``` # Recipient delimiter, character used to delimiter localpart from custom address part RECIPIENT_DELIMITER=+ ``` In the container's `/etc/postfix/main.cf` it evaluated correctly: ``` # Recipient delimiter for extended addresses recipient_delimiter = + ``` Results in the following errors in the smtp logs: ``` [email protected] | postfix/smtpd[26303]: NOQUEUE: reject: RCPT from unknown[10.255.0.2]: 550 5.1.1 <[email protected]>: Recipient address rejected: User unknown in virtual mailbox table; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<smtp.github.com> ``` And in admin it is seen that the part after delimiter is not cut by postfix and send as-is to through podop: ``` [email protected] | 192.168.203.4 - - [18/Dec/2018:08:18:17 +0000] "GET /internal/postfix/sender/access/[email protected] HTTP/1.1" 404 233 "-" "Python/3.6 aiohttp/3.4.4" [email protected] | 192.168.203.4 - - [18/Dec/2018:08:18:17 +0000] "GET /internal/postfix/alias/[email protected] HTTP/1.1" 404 233 "-" "Python/3.6 aiohttp/3.4.4" [email protected] | 192.168.203.4 - - [18/Dec/2018:08:18:17 +0000] "GET /internal/postfix/mailbox/[email protected] HTTP/1.1" 404 233 "-" "Python/3.6 aiohttp/3.4.4" ```
Can confirm โ€” this also shows up here! ``` smtp_1_dd4911cb7d82 | postfix/smtpd[481]: name_mask: all smtp_1_dd4911cb7d82 | postfix/smtpd[481]: inet_addr_local: configured 3 IPv4 addresses smtp_1_dd4911cb7d82 | postfix/smtpd[481]: inet_addr_local: configured 0 IPv6 addresses smtp_1_dd4911cb7d82 | postfix/smtpd[481]: process generation: 17 (17) smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_string: parent_domain_matches_subdomains: smtpd_client_event_limit_exceptions ~? debug_peer_list smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_string: parent_domain_matches_subdomains: smtpd_client_event_limit_exceptions ~? fast_flush_domains smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_string: parent_domain_matches_subdomains: smtpd_client_event_limit_exceptions ~? mynetworks smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_string: parent_domain_matches_subdomains: smtpd_client_event_limit_exceptions ~? permit_mx_backup_networks smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_string: parent_domain_matches_subdomains: smtpd_client_event_limit_exceptions ~? qmqpd_authorized_clients smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_string: parent_domain_matches_subdomains: smtpd_client_event_limit_exceptions ~? relay_domains smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_string: parent_domain_matches_subdomains: smtpd_client_event_limit_exceptions ~? smtpd_access_maps smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_list_match: smtpd_client_event_limit_exceptions: no match smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_string: parent_domain_matches_subdomains: mynetworks ~? debug_peer_list smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_string: parent_domain_matches_subdomains: mynetworks ~? fast_flush_domains smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_string: parent_domain_matches_subdomains: mynetworks ~? mynetworks smtp_1_dd4911cb7d82 | postfix/smtpd[481]: name_mask: host smtp_1_dd4911cb7d82 | postfix/smtpd[481]: been_here: 127.0.0.1/32: 0 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: been_here: 172.19.199.5/32: 0 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: been_here: 172.31.0.12/32: 0 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: mynetworks_core: 127.0.0.1/32 172.19.199.5/32 172.31.0.12/32 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_string: parent_domain_matches_subdomains: mynetworks ~? debug_peer_list smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_string: parent_domain_matches_subdomains: mynetworks ~? fast_flush_domains smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_string: parent_domain_matches_subdomains: mynetworks ~? mynetworks smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_string: parent_domain_matches_subdomains: relay_domains ~? debug_peer_list smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_string: parent_domain_matches_subdomains: relay_domains ~? fast_flush_domains smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_string: parent_domain_matches_subdomains: relay_domains ~? mynetworks smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_string: parent_domain_matches_subdomains: relay_domains ~? permit_mx_backup_networks smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_string: parent_domain_matches_subdomains: relay_domains ~? qmqpd_authorized_clients smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_string: parent_domain_matches_subdomains: relay_domains ~? relay_domains smtp_1_dd4911cb7d82 | postfix/smtpd[481]: auto_clnt_create: transport=unix endpoint=/tmp/podop.socket smtp_1_dd4911cb7d82 | postfix/smtpd[481]: dict_open: socketmap:unix:/tmp/podop.socket:transport smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_string: parent_domain_matches_subdomains: permit_mx_backup_networks ~? debug_peer_list smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_string: parent_domain_matches_subdomains: permit_mx_backup_networks ~? fast_flush_domains smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_string: parent_domain_matches_subdomains: permit_mx_backup_networks ~? mynetworks smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_string: parent_domain_matches_subdomains: permit_mx_backup_networks ~? permit_mx_backup_networks smtp_1_dd4911cb7d82 | postfix/smtpd[481]: connect to subsystem private/proxymap smtp_1_dd4911cb7d82 | postfix/smtpd[481]: send attr request = open smtp_1_dd4911cb7d82 | postfix/smtpd[481]: send attr table = unix:passwd.byname smtp_1_dd4911cb7d82 | postfix/smtpd[481]: send attr flags = 0 smtp_1_dd4911cb7d82 | postfix/proxymap[482]: name_mask: all smtp_1_dd4911cb7d82 | postfix/proxymap[482]: inet_addr_local: configured 3 IPv4 addresses smtp_1_dd4911cb7d82 | postfix/proxymap[482]: inet_addr_local: configured 0 IPv6 addresses smtp_1_dd4911cb7d82 | postfix/proxymap[482]: process generation: 20 (20) smtp_1_dd4911cb7d82 | postfix/proxymap[482]: connection established fd 128 smtp_1_dd4911cb7d82 | postfix/proxymap[482]: master_notify: status 0 smtp_1_dd4911cb7d82 | postfix/proxymap[482]: proxymap socket: wanted attribute: request smtp_1_dd4911cb7d82 | postfix/proxymap[482]: input attribute name: request smtp_1_dd4911cb7d82 | postfix/proxymap[482]: input attribute value: open smtp_1_dd4911cb7d82 | postfix/proxymap[482]: proxymap socket: wanted attribute: table smtp_1_dd4911cb7d82 | postfix/proxymap[482]: input attribute name: table smtp_1_dd4911cb7d82 | postfix/proxymap[482]: input attribute value: unix:passwd.byname smtp_1_dd4911cb7d82 | postfix/proxymap[482]: proxymap socket: wanted attribute: flags smtp_1_dd4911cb7d82 | postfix/proxymap[482]: input attribute name: flags smtp_1_dd4911cb7d82 | postfix/proxymap[482]: input attribute value: 0 smtp_1_dd4911cb7d82 | postfix/proxymap[482]: proxymap socket: wanted attribute: (list terminator) smtp_1_dd4911cb7d82 | postfix/proxymap[482]: input attribute name: (end) smtp_1_dd4911cb7d82 | postfix/proxymap[482]: proxy_map_find: unix:passwd.byname: smtp_1_dd4911cb7d82 | postfix/proxymap[482]: dict_open: unix:passwd.byname smtp_1_dd4911cb7d82 | postfix/proxymap[482]: send attr status = 0 smtp_1_dd4911cb7d82 | postfix/proxymap[482]: send attr flags = 16 smtp_1_dd4911cb7d82 | postfix/proxymap[482]: master_notify: status 1 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: private/proxymap socket: wanted attribute: status smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute name: status smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute value: 0 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: private/proxymap socket: wanted attribute: flags smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute name: flags smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute value: 16 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: private/proxymap socket: wanted attribute: (list terminator) smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute name: (end) smtp_1_dd4911cb7d82 | postfix/smtpd[481]: dict_proxy_open: connect to map=unix:passwd.byname status=0 server_flags=fixed smtp_1_dd4911cb7d82 | postfix/smtpd[481]: dict_open: proxy:unix:passwd.byname smtp_1_dd4911cb7d82 | postfix/smtpd[481]: dict_open: socketmap:unix:/tmp/podop.socket:alias smtp_1_dd4911cb7d82 | postfix/smtpd[481]: dict_open: socketmap:unix:/tmp/podop.socket:mailbox smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_string: parent_domain_matches_subdomains: smtpd_access_maps ~? debug_peer_list smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_string: parent_domain_matches_subdomains: smtpd_access_maps ~? fast_flush_domains smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_string: parent_domain_matches_subdomains: smtpd_access_maps ~? mynetworks smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_string: parent_domain_matches_subdomains: smtpd_access_maps ~? permit_mx_backup_networks smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_string: parent_domain_matches_subdomains: smtpd_access_maps ~? qmqpd_authorized_clients smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_string: parent_domain_matches_subdomains: smtpd_access_maps ~? relay_domains smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_string: parent_domain_matches_subdomains: smtpd_access_maps ~? smtpd_access_maps smtp_1_dd4911cb7d82 | postfix/smtpd[481]: dict_open: socketmap:unix:/tmp/podop.socket:senderlogin smtp_1_dd4911cb7d82 | postfix/smtpd[481]: dict_open: socketmap:unix:/tmp/podop.socket:senderaccess smtp_1_dd4911cb7d82 | postfix/smtpd[481]: unknown_helo_hostname_tempfail_action = defer_if_permit smtp_1_dd4911cb7d82 | postfix/smtpd[481]: unknown_address_tempfail_action = defer_if_permit smtp_1_dd4911cb7d82 | postfix/smtpd[481]: unverified_recipient_tempfail_action = defer_if_permit smtp_1_dd4911cb7d82 | postfix/smtpd[481]: unverified_sender_tempfail_action = defer_if_permit smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_string: parent_domain_matches_subdomains: debug_peer_list ~? debug_peer_list smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_string: parent_domain_matches_subdomains: fast_flush_domains ~? debug_peer_list smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_string: parent_domain_matches_subdomains: fast_flush_domains ~? fast_flush_domains smtp_1_dd4911cb7d82 | postfix/smtpd[481]: auto_clnt_create: transport=local endpoint=private/anvil smtp_1_dd4911cb7d82 | postfix/smtpd[481]: connection established smtp_1_dd4911cb7d82 | postfix/smtpd[481]: master_notify: status 0 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: name_mask: resource smtp_1_dd4911cb7d82 | postfix/smtpd[481]: name_mask: software smtp_1_dd4911cb7d82 | postfix/smtpd[481]: connect from localhost[127.0.0.1] smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_hostname: smtpd_authorized_xclient_hosts: localhost ~? 172.31.0.0/24 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_hostaddr: smtpd_authorized_xclient_hosts: 127.0.0.1 ~? 172.31.0.0/24 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_list_match: localhost: no match smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_list_match: 127.0.0.1: no match smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_list_match: localhost: no match smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_list_match: 127.0.0.1: no match smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_hostname: debug_peer_list: localhost ~? 0.0.0.0 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_hostaddr: debug_peer_list: 127.0.0.1 ~? 0.0.0.0 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_list_match: localhost: no match smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_list_match: 127.0.0.1: no match smtp_1_dd4911cb7d82 | postfix/smtpd[481]: smtp_stream_setup: maxtime=300 enable_deadline=0 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_hostname: smtpd_client_event_limit_exceptions: localhost ~? 127.0.0.1/32 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_hostaddr: smtpd_client_event_limit_exceptions: 127.0.0.1 ~? 127.0.0.1/32 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: report connect to all milters smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: "j" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: result "mail.XXXX" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: "{daemon_name}" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: result "mail.XXXX" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: "{daemon_addr}" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: result "127.0.0.1" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: "v" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: result "Postfix 3.3.0" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter8_connect: non-protocol events for protocol version 6: smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter8_connect: transport=inet endpoint=antispam:11332 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: trying... [172.31.0.10] smtp_1_dd4911cb7d82 | postfix/smtpd[481]: vstream_tweak_tcp: TCP_MAXSEG 1448 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter8_connect: my_version=0x6 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter8_connect: my_actions=0x1ff SMFIF_ADDHDRS SMFIF_CHGBODY SMFIF_ADDRCPT SMFIF_DELRCPT SMFIF_CHGHDRS SMFIF_QUARANTINE SMFIF_CHGFROM SMFIF_ADDRCPT_PAR SMFIF_SETSYMLIST smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter8_connect: my_events=0x1fffff SMFIP_NOCONNECT SMFIP_NOHELO SMFIP_NOMAIL SMFIP_NORCPT SMFIP_NOBODY SMFIP_NOHDRS SMFIP_NOEOH SMFIP_NR_HDR SMFIP_NOUNKNOWN SMFIP_NODATA SMFIP_SKIP SMFIP_RCPT_REJ SMFIP_NR_CONN SMFIP_NR_HELO SMFIP_NR_MAIL SMFIP_NR_RCPT SMFIP_NR_DATA SMFIP_NR_UNKN SMFIP_NR_EOH SMFIP_NR_BODY SMFIP_HDR_LEADSPC smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter8_connect: milter inet:antispam:11332 version 6 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter8_connect: events SMFIP_NR_HDR SMFIP_NR_CONN SMFIP_NR_HELO SMFIP_NR_MAIL SMFIP_NR_RCPT SMFIP_NR_DATA SMFIP_NR_UNKN SMFIP_NR_EOH SMFIP_NR_BODY smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter8_connect: requests SMFIF_ADDHDRS SMFIF_CHGBODY SMFIF_ADDRCPT SMFIF_DELRCPT SMFIF_CHGHDRS SMFIF_QUARANTINE SMFIF_CHGFROM SMFIF_ADDRCPT_PAR SMFIF_SETSYMLIST smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter8_conn_event: milter inet:antispam:11332: connect localhost/127.0.0.1 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: event: SMFIC_CONNECT; macros: j=mail.XXXX {daemon_name}=mail.XXXX {daemon_addr}=127.0.0.1 v=Postfix 3.3.0 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: skipping reply for event SMFIC_CONNECT from milter inet:antispam:11332 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: > localhost[127.0.0.1]: 220 mail.XXXX ESMTP Postfix smtp_1_dd4911cb7d82 | postfix/smtpd[481]: < localhost[127.0.0.1]: QUIT smtp_1_dd4911cb7d82 | postfix/smtpd[481]: > localhost[127.0.0.1]: 221 2.0.0 Bye smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_hostname: smtpd_client_event_limit_exceptions: localhost ~? 127.0.0.1/32 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_hostaddr: smtpd_client_event_limit_exceptions: 127.0.0.1 ~? 127.0.0.1/32 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: disconnect event to all milters smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter8_disc_event: quit milter inet:antispam:11332 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: disconnect from localhost[127.0.0.1] quit=1 commands=1 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: free all milters smtp_1_dd4911cb7d82 | postfix/smtpd[481]: free milter inet:antispam:11332 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: master_notify: status 1 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: connection closed admin_1_32aa1309eb8f | 127.0.0.1 - - [26/Dec/2018:21:54:05 +0000] "GET /ui/login?next=ui.index HTTP/1.1" 200 4460 "-" "curl/7.61.1" admin_1_32aa1309eb8f | 172.31.0.5 - - [26/Dec/2018:21:54:06 +0000] "GET /internal/auth/email HTTP/1.0" 200 0 "-" "-" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: connection established smtp_1_dd4911cb7d82 | postfix/smtpd[481]: master_notify: status 0 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: name_mask: resource smtp_1_dd4911cb7d82 | postfix/smtpd[481]: name_mask: software smtp_1_dd4911cb7d82 | postfix/smtpd[481]: connect from mailu_front_1_9bbf1900ac4b.mailu_default[172.31.0.5] smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_hostname: smtpd_authorized_xclient_hosts: mailu_front_1_9bbf1900ac4b.mailu_default ~? 172.31.0.0/24 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_hostaddr: smtpd_authorized_xclient_hosts: 172.31.0.5 ~? 172.31.0.0/24 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_list_match: mailu_front_1_9bbf1900ac4b.mailu_default: no match smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_list_match: 172.31.0.5: no match smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_hostname: debug_peer_list: mailu_front_1_9bbf1900ac4b.mailu_default ~? 0.0.0.0 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_hostaddr: debug_peer_list: 172.31.0.5 ~? 0.0.0.0 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_list_match: mailu_front_1_9bbf1900ac4b.mailu_default: no match smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_list_match: 172.31.0.5: no match smtp_1_dd4911cb7d82 | postfix/smtpd[481]: smtp_stream_setup: maxtime=300 enable_deadline=0 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: report connect to all milters smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: "j" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: result "mail.XXXX" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: "{daemon_name}" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: result "mail.XXXX" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: "{daemon_addr}" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: result "172.31.0.12" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: "v" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: result "Postfix 3.3.0" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter8_connect: non-protocol events for protocol version 6: smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter8_connect: transport=inet endpoint=antispam:11332 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: trying... [172.31.0.10] smtp_1_dd4911cb7d82 | postfix/smtpd[481]: vstream_tweak_tcp: TCP_MAXSEG 1448 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter8_connect: my_version=0x6 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter8_connect: my_actions=0x1ff SMFIF_ADDHDRS SMFIF_CHGBODY SMFIF_ADDRCPT SMFIF_DELRCPT SMFIF_CHGHDRS SMFIF_QUARANTINE SMFIF_CHGFROM SMFIF_ADDRCPT_PAR SMFIF_SETSYMLIST smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter8_connect: my_events=0x1fffff SMFIP_NOCONNECT SMFIP_NOHELO SMFIP_NOMAIL SMFIP_NORCPT SMFIP_NOBODY SMFIP_NOHDRS SMFIP_NOEOH SMFIP_NR_HDR SMFIP_NOUNKNOWN SMFIP_NODATA SMFIP_SKIP SMFIP_RCPT_REJ SMFIP_NR_CONN SMFIP_NR_HELO SMFIP_NR_MAIL SMFIP_NR_RCPT SMFIP_NR_DATA SMFIP_NR_UNKN SMFIP_NR_EOH SMFIP_NR_BODY SMFIP_HDR_LEADSPC smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter8_connect: milter inet:antispam:11332 version 6 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter8_connect: events SMFIP_NR_HDR SMFIP_NR_CONN SMFIP_NR_HELO SMFIP_NR_MAIL SMFIP_NR_RCPT SMFIP_NR_DATA SMFIP_NR_UNKN SMFIP_NR_EOH SMFIP_NR_BODY smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter8_connect: requests SMFIF_ADDHDRS SMFIF_CHGBODY SMFIF_ADDRCPT SMFIF_DELRCPT SMFIF_CHGHDRS SMFIF_QUARANTINE SMFIF_CHGFROM SMFIF_ADDRCPT_PAR SMFIF_SETSYMLIST smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter8_conn_event: milter inet:antispam:11332: connect mailu_front_1_9bbf1900ac4b.mailu_default/172.31.0.5 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: event: SMFIC_CONNECT; macros: j=mail.XXXX {daemon_name}=mail.XXXX {daemon_addr}=172.31.0.12 v=Postfix 3.3.0 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: skipping reply for event SMFIC_CONNECT from milter inet:antispam:11332 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: > mailu_front_1_9bbf1900ac4b.mailu_default[172.31.0.5]: 220 mail.XXXX ESMTP Postfix smtp_1_dd4911cb7d82 | postfix/smtpd[481]: < mailu_front_1_9bbf1900ac4b.mailu_default[172.31.0.5]: EHLO mail.XXXX smtp_1_dd4911cb7d82 | postfix/smtpd[481]: report helo to all milters smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: "{tls_version}" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: "{cipher}" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: "{cipher_bits}" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: "{cert_subject}" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: "{cert_issuer}" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter8_helo_event: milter inet:antispam:11332: helo mail.XXXX smtp_1_dd4911cb7d82 | postfix/smtpd[481]: event: SMFIC_HELO; macros: (none) smtp_1_dd4911cb7d82 | postfix/smtpd[481]: skipping reply for event SMFIC_HELO from milter inet:antispam:11332 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_list_match: mailu_front_1_9bbf1900ac4b.mailu_default: no match smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_list_match: 172.31.0.5: no match smtp_1_dd4911cb7d82 | postfix/smtpd[481]: > mailu_front_1_9bbf1900ac4b.mailu_default[172.31.0.5]: 250-mail.XXXX smtp_1_dd4911cb7d82 | postfix/smtpd[481]: > mailu_front_1_9bbf1900ac4b.mailu_default[172.31.0.5]: 250-PIPELINING smtp_1_dd4911cb7d82 | postfix/smtpd[481]: > mailu_front_1_9bbf1900ac4b.mailu_default[172.31.0.5]: 250-SIZE 150000000 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: > mailu_front_1_9bbf1900ac4b.mailu_default[172.31.0.5]: 250-VRFY smtp_1_dd4911cb7d82 | postfix/smtpd[481]: > mailu_front_1_9bbf1900ac4b.mailu_default[172.31.0.5]: 250-ETRN smtp_1_dd4911cb7d82 | postfix/smtpd[481]: > mailu_front_1_9bbf1900ac4b.mailu_default[172.31.0.5]: 250-XCLIENT NAME ADDR PROTO HELO REVERSE_NAME PORT LOGIN DESTADDR DESTPORT smtp_1_dd4911cb7d82 | postfix/smtpd[481]: > mailu_front_1_9bbf1900ac4b.mailu_default[172.31.0.5]: 250-ENHANCEDSTATUSCODES smtp_1_dd4911cb7d82 | postfix/smtpd[481]: > mailu_front_1_9bbf1900ac4b.mailu_default[172.31.0.5]: 250-8BITMIME smtp_1_dd4911cb7d82 | postfix/smtpd[481]: > mailu_front_1_9bbf1900ac4b.mailu_default[172.31.0.5]: 250 DSN smtp_1_dd4911cb7d82 | postfix/smtpd[481]: < mailu_front_1_9bbf1900ac4b.mailu_default[172.31.0.5]: XCLIENT ADDR=172.31.0.1 NAME=[UNAVAILABLE] smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_hostname: smtpd_authorized_xclient_hosts: unknown ~? 172.31.0.0/24 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_hostaddr: smtpd_authorized_xclient_hosts: 172.31.0.1 ~? 172.31.0.0/24 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: abort all milters smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter8_abort: abort milter inet:antispam:11332 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: disconnect event to all milters smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter8_disc_event: quit milter inet:antispam:11332 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: free all milters smtp_1_dd4911cb7d82 | postfix/smtpd[481]: free milter inet:antispam:11332 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: report connect to all milters smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: "j" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: result "mail.XXXX" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: "{daemon_name}" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: result "mail.XXXX" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: "{daemon_addr}" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: result "172.31.0.12" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: "v" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: result "Postfix 3.3.0" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter8_connect: non-protocol events for protocol version 6: smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter8_connect: transport=inet endpoint=antispam:11332 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: trying... [172.31.0.10] smtp_1_dd4911cb7d82 | postfix/smtpd[481]: vstream_tweak_tcp: TCP_MAXSEG 1448 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter8_connect: my_version=0x6 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter8_connect: my_actions=0x1ff SMFIF_ADDHDRS SMFIF_CHGBODY SMFIF_ADDRCPT SMFIF_DELRCPT SMFIF_CHGHDRS SMFIF_QUARANTINE SMFIF_CHGFROM SMFIF_ADDRCPT_PAR SMFIF_SETSYMLIST smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter8_connect: my_events=0x1fffff SMFIP_NOCONNECT SMFIP_NOHELO SMFIP_NOMAIL SMFIP_NORCPT SMFIP_NOBODY SMFIP_NOHDRS SMFIP_NOEOH SMFIP_NR_HDR SMFIP_NOUNKNOWN SMFIP_NODATA SMFIP_SKIP SMFIP_RCPT_REJ SMFIP_NR_CONN SMFIP_NR_HELO SMFIP_NR_MAIL SMFIP_NR_RCPT SMFIP_NR_DATA SMFIP_NR_UNKN SMFIP_NR_EOH SMFIP_NR_BODY SMFIP_HDR_LEADSPC smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter8_connect: milter inet:antispam:11332 version 6 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter8_connect: events SMFIP_NR_HDR SMFIP_NR_CONN SMFIP_NR_HELO SMFIP_NR_MAIL SMFIP_NR_RCPT SMFIP_NR_DATA SMFIP_NR_UNKN SMFIP_NR_EOH SMFIP_NR_BODY smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter8_connect: requests SMFIF_ADDHDRS SMFIF_CHGBODY SMFIF_ADDRCPT SMFIF_DELRCPT SMFIF_CHGHDRS SMFIF_QUARANTINE SMFIF_CHGFROM SMFIF_ADDRCPT_PAR SMFIF_SETSYMLIST smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter8_conn_event: milter inet:antispam:11332: connect unknown/172.31.0.1 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: event: SMFIC_CONNECT; macros: j=mail.XXXX {daemon_name}=mail.XXXX {daemon_addr}=172.31.0.12 v=Postfix 3.3.0 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: skipping reply for event SMFIC_CONNECT from milter inet:antispam:11332 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: > unknown[172.31.0.1]: 220 mail.XXXX ESMTP Postfix smtp_1_dd4911cb7d82 | postfix/smtpd[481]: < unknown[172.31.0.1]: EHLO sending.doma.in smtp_1_dd4911cb7d82 | postfix/smtpd[481]: report helo to all milters smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: "{tls_version}" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: "{cipher}" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: "{cipher_bits}" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: "{cert_subject}" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: "{cert_issuer}" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter8_helo_event: milter inet:antispam:11332: helo sending.doma.in smtp_1_dd4911cb7d82 | postfix/smtpd[481]: event: SMFIC_HELO; macros: (none) smtp_1_dd4911cb7d82 | postfix/smtpd[481]: skipping reply for event SMFIC_HELO from milter inet:antispam:11332 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_list_match: unknown: no match smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_list_match: 172.31.0.1: no match smtp_1_dd4911cb7d82 | postfix/smtpd[481]: > unknown[172.31.0.1]: 250-mail.XXXX smtp_1_dd4911cb7d82 | postfix/smtpd[481]: > unknown[172.31.0.1]: 250-PIPELINING smtp_1_dd4911cb7d82 | postfix/smtpd[481]: > unknown[172.31.0.1]: 250-SIZE 150000000 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: > unknown[172.31.0.1]: 250-VRFY smtp_1_dd4911cb7d82 | postfix/smtpd[481]: > unknown[172.31.0.1]: 250-ETRN smtp_1_dd4911cb7d82 | postfix/smtpd[481]: > unknown[172.31.0.1]: 250-XCLIENT NAME ADDR PROTO HELO REVERSE_NAME PORT LOGIN DESTADDR DESTPORT smtp_1_dd4911cb7d82 | postfix/smtpd[481]: > unknown[172.31.0.1]: 250-ENHANCEDSTATUSCODES smtp_1_dd4911cb7d82 | postfix/smtpd[481]: > unknown[172.31.0.1]: 250-8BITMIME smtp_1_dd4911cb7d82 | postfix/smtpd[481]: > unknown[172.31.0.1]: 250 DSN smtp_1_dd4911cb7d82 | postfix/smtpd[481]: < unknown[172.31.0.1]: MAIL FROM:<[email protected]> smtp_1_dd4911cb7d82 | postfix/smtpd[481]: extract_addr: input: <[email protected]> smtp_1_dd4911cb7d82 | postfix/smtpd[481]: smtpd_check_addr: [email protected] smtp_1_dd4911cb7d82 | postfix/smtpd[481]: connect to subsystem private/rewrite smtp_1_dd4911cb7d82 | postfix/smtpd[481]: send attr request = rewrite smtp_1_dd4911cb7d82 | postfix/smtpd[481]: send attr rule = local smtp_1_dd4911cb7d82 | postfix/smtpd[481]: send attr address = "" smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: name_mask: all smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: inet_addr_local: configured 3 IPv4 addresses smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: inet_addr_local: configured 0 IPv6 addresses smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: process generation: 21 (21) smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: auto_clnt_create: transport=unix endpoint=/tmp/podop.socket smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: dict_open: socketmap:unix:/tmp/podop.socket:domain smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: match_string: parent_domain_matches_subdomains: relay_domains ~? debug_peer_list smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: match_string: parent_domain_matches_subdomains: relay_domains ~? fast_flush_domains smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: match_string: parent_domain_matches_subdomains: relay_domains ~? mynetworks smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: match_string: parent_domain_matches_subdomains: relay_domains ~? permit_mx_backup_networks smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: match_string: parent_domain_matches_subdomains: relay_domains ~? qmqpd_authorized_clients smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: match_string: parent_domain_matches_subdomains: relay_domains ~? relay_domains smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: dict_open: socketmap:unix:/tmp/podop.socket:transport smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: dict_open: socketmap:unix:/tmp/podop.socket:transport smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: match_string: parent_domain_matches_subdomains: transport_maps ~? debug_peer_list smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: match_string: parent_domain_matches_subdomains: transport_maps ~? fast_flush_domains smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: match_string: parent_domain_matches_subdomains: transport_maps ~? mynetworks smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: match_string: parent_domain_matches_subdomains: transport_maps ~? permit_mx_backup_networks smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: match_string: parent_domain_matches_subdomains: transport_maps ~? qmqpd_authorized_clients smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: match_string: parent_domain_matches_subdomains: transport_maps ~? relay_domains smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: match_string: parent_domain_matches_subdomains: transport_maps ~? smtpd_access_maps smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: match_list_match: transport_maps: no match smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: dict_sockmap_lookup: key * smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: auto_clnt_open: connected to /tmp/podop.socket smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: maps_find: transport_maps: *: not found smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: match_string: parent_domain_matches_subdomains: transport_maps ~? debug_peer_list smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: match_string: parent_domain_matches_subdomains: transport_maps ~? fast_flush_domains smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: match_string: parent_domain_matches_subdomains: transport_maps ~? mynetworks smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: match_string: parent_domain_matches_subdomains: transport_maps ~? permit_mx_backup_networks smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: match_string: parent_domain_matches_subdomains: transport_maps ~? qmqpd_authorized_clients smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: match_string: parent_domain_matches_subdomains: transport_maps ~? relay_domains smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: match_string: parent_domain_matches_subdomains: transport_maps ~? smtpd_access_maps smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: match_list_match: transport_maps: no match smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: dict_sockmap_lookup: key * admin_1_32aa1309eb8f | 172.31.0.12 - - [26/Dec/2018:21:54:06 +0000] "GET /internal/postfix/transport/* HTTP/1.1" 404 233 "-" "Python/3.6 aiohttp/3.5.1" smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: maps_find: address_verify_transport_maps: *: not found smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: connection established fd 128 smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: master_notify: status 0 smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: rewrite socket: wanted attribute: request smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute name: request smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute value: rewrite smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: rewrite socket: wanted attribute: rule smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute name: rule smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute value: local smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: rewrite socket: wanted attribute: address smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute name: address smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute value: "" smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: rewrite socket: wanted attribute: (list terminator) smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute name: (end) smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: `local' `""' -> `""' smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: send attr flags = 0 smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: send attr address = "" smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: master_notify: status 1 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: private/rewrite socket: wanted attribute: flags smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute name: flags smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute value: 0 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: private/rewrite socket: wanted attribute: address smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute name: address smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute value: "" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: private/rewrite socket: wanted attribute: (list terminator) smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute name: (end) smtp_1_dd4911cb7d82 | postfix/smtpd[481]: rewrite_clnt: local: "" -> "" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: send attr request = rewrite smtp_1_dd4911cb7d82 | postfix/smtpd[481]: send attr rule = local smtp_1_dd4911cb7d82 | postfix/smtpd[481]: send attr address = [email protected] smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: master_notify: status 0 smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: rewrite socket: wanted attribute: request smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute name: request smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute value: rewrite smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: rewrite socket: wanted attribute: rule smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute name: rule smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute value: local smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: rewrite socket: wanted attribute: address smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute name: address smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute value: [email protected] smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: rewrite socket: wanted attribute: (list terminator) smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute name: (end) smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: `local' `[email protected]' -> `[email protected]' smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: send attr flags = 0 smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: send attr address = [email protected] smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: master_notify: status 1 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: private/rewrite socket: wanted attribute: flags smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute name: flags smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute value: 0 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: private/rewrite socket: wanted attribute: address smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute name: address smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute value: [email protected] smtp_1_dd4911cb7d82 | postfix/smtpd[481]: private/rewrite socket: wanted attribute: (list terminator) smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute name: (end) smtp_1_dd4911cb7d82 | postfix/smtpd[481]: rewrite_clnt: local: [email protected] -> [email protected] smtp_1_dd4911cb7d82 | postfix/smtpd[481]: send attr request = resolve smtp_1_dd4911cb7d82 | postfix/smtpd[481]: send attr sender = smtp_1_dd4911cb7d82 | postfix/smtpd[481]: send attr address = [email protected] smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: master_notify: status 0 smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: rewrite socket: wanted attribute: request smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute name: request smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute value: resolve smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: rewrite socket: wanted attribute: sender smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute name: sender smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute value: (end) smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: rewrite socket: wanted attribute: address smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute name: address smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute value: [email protected] smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: rewrite socket: wanted attribute: (list terminator) smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute name: (end) smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: match_list_match: sending.doma.in: no match smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: match_string: virtual_mailbox_domains: sending.doma.in ~? socketmap:unix:/tmp/podop.socket:domain(0,lock|utf8_request) smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: dict_sockmap_lookup: key sending.doma.in admin_1_32aa1309eb8f | 172.31.0.12 - - [26/Dec/2018:21:54:06 +0000] "GET /internal/postfix/transport/* HTTP/1.1" 404 233 "-" "Python/3.6 aiohttp/3.5.1" admin_1_32aa1309eb8f | 172.31.0.12 - - [26/Dec/2018:21:54:06 +0000] "GET /internal/postfix/domain/sending.doma.in HTTP/1.1" 404 233 "-" "Python/3.6 aiohttp/3.5.1" smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: match_list_match: sending.doma.in: no match smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: match_hostname: relay_domains: sending.doma.in ~? socketmap:unix:/tmp/podop.socket:transport(0,lock|utf8_request) smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: dict_sockmap_lookup: key sending.doma.in admin_1_32aa1309eb8f | 172.31.0.12 - - [26/Dec/2018:21:54:06 +0000] "GET /internal/postfix/transport/sending.doma.in HTTP/1.1" 404 233 "-" "Python/3.6 aiohttp/3.5.1" smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: match_list_match: sending.doma.in: no match smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: dict_sockmap_lookup: key [email protected] admin_1_32aa1309eb8f | 172.31.0.12 - - [26/Dec/2018:21:54:06 +0000] "GET /internal/postfix/transport/[email protected] HTTP/1.1" 404 233 "-" "Python/3.6 aiohttp/3.5.1" smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: maps_find: transport_maps: [email protected]: not found smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: maps_find: transport_maps: sending.doma.in: not found smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: maps_find: transport_maps: .de: not found smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: mail_addr_find: [email protected] -> (not found) smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: `' -> `[email protected]' -> (`smtp' `sending.doma.in' `[email protected]' `4096') smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: send attr flags = 0 smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: send attr transport = smtp smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: send attr nexthop = sending.doma.in smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: send attr recipient = [email protected] smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: send attr flags = 4096 smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: master_notify: status 1 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: private/rewrite socket: wanted attribute: flags smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute name: flags smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute value: 0 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: private/rewrite socket: wanted attribute: transport smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute name: transport smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute value: smtp smtp_1_dd4911cb7d82 | postfix/smtpd[481]: private/rewrite socket: wanted attribute: nexthop smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute name: nexthop smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute value: sending.doma.in smtp_1_dd4911cb7d82 | postfix/smtpd[481]: private/rewrite socket: wanted attribute: recipient smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute name: recipient smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute value: [email protected] smtp_1_dd4911cb7d82 | postfix/smtpd[481]: private/rewrite socket: wanted attribute: flags smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute name: flags smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute value: 4096 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: private/rewrite socket: wanted attribute: (list terminator) smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute name: (end) smtp_1_dd4911cb7d82 | postfix/smtpd[481]: resolve_clnt: `' -> `[email protected]' -> transp=`smtp' host=`sending.doma.in' rcpt=`[email protected]' flags= class=default smtp_1_dd4911cb7d82 | postfix/smtpd[481]: ctable_locate: install entry key [email protected] smtp_1_dd4911cb7d82 | postfix/smtpd[481]: extract_addr: in: <[email protected]>, result: [email protected] smtp_1_dd4911cb7d82 | postfix/smtpd[481]: send attr request = rewrite smtp_1_dd4911cb7d82 | postfix/smtpd[481]: send attr rule = local smtp_1_dd4911cb7d82 | postfix/smtpd[481]: send attr address = double-bounce smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: master_notify: status 0 smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: rewrite socket: wanted attribute: request smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute name: request smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute value: rewrite smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: rewrite socket: wanted attribute: rule smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute name: rule smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute value: local smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: rewrite socket: wanted attribute: address smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute name: address smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute value: double-bounce smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: rewrite socket: wanted attribute: (list terminator) smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute name: (end) smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: `local' `double-bounce' -> `double-bounce@XXXX' smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: send attr flags = 0 smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: send attr address = double-bounce@XXXX smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: master_notify: status 1 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: private/rewrite socket: wanted attribute: flags smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute name: flags smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute value: 0 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: private/rewrite socket: wanted attribute: address smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute name: address smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute value: double-bounce@XXXX smtp_1_dd4911cb7d82 | postfix/smtpd[481]: private/rewrite socket: wanted attribute: (list terminator) smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute name: (end) smtp_1_dd4911cb7d82 | postfix/smtpd[481]: rewrite_clnt: local: double-bounce -> double-bounce@XXXX smtp_1_dd4911cb7d82 | postfix/smtpd[481]: report sender to all milters smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: "i" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: "{mail_addr}" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: ctable_locate: leave existing entry key [email protected] smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: result "[email protected]" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: "{client_addr}" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: result "172.31.0.1" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: "{client_name}" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: result "unknown" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter_macro_lookup: "{auth_authen}" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter8_mail_event: milter inet:antispam:11332: mail <[email protected]> smtp_1_dd4911cb7d82 | postfix/smtpd[481]: event: SMFIC_MAIL; macros: {mail_addr}[email protected] {client_addr}=172.31.0.1 {client_name}=unknown smtp_1_dd4911cb7d82 | postfix/smtpd[481]: skipping reply for event SMFIC_MAIL from milter inet:antispam:11332 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: smtpd_check_rewrite: trying: permit_inet_interfaces smtp_1_dd4911cb7d82 | postfix/smtpd[481]: permit_inet_interfaces: unknown 172.31.0.1 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: fsspace: .: block size 4096, blocks free 434503694 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: smtpd_check_queue: blocks 4096 avail 434503694 min_free 0 msg_size_limit 150000000 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: > unknown[172.31.0.1]: 250 2.1.0 Ok smtp_1_dd4911cb7d82 | postfix/smtpd[481]: < unknown[172.31.0.1]: RCPT TO:<testfoo+bar@XXXX> smtp_1_dd4911cb7d82 | postfix/smtpd[481]: extract_addr: input: <testfoo+bar@XXXX> smtp_1_dd4911cb7d82 | postfix/smtpd[481]: smtpd_check_addr: addr=testfoo+bar@XXXX smtp_1_dd4911cb7d82 | postfix/smtpd[481]: send attr request = rewrite smtp_1_dd4911cb7d82 | postfix/smtpd[481]: send attr rule = local smtp_1_dd4911cb7d82 | postfix/smtpd[481]: send attr address = [email protected] smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: master_notify: status 0 smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: rewrite socket: wanted attribute: request smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute name: request smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute value: rewrite smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: rewrite socket: wanted attribute: rule smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute name: rule smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute value: local smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: rewrite socket: wanted attribute: address smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute name: address smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute value: [email protected] smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: rewrite socket: wanted attribute: (list terminator) smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute name: (end) smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: `local' `[email protected]' -> `[email protected]' smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: send attr flags = 0 smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: send attr address = [email protected] smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: master_notify: status 1 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: private/rewrite socket: wanted attribute: flags smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute name: flags smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute value: 0 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: private/rewrite socket: wanted attribute: address smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute name: address smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute value: [email protected] smtp_1_dd4911cb7d82 | postfix/smtpd[481]: private/rewrite socket: wanted attribute: (list terminator) smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute name: (end) smtp_1_dd4911cb7d82 | postfix/smtpd[481]: rewrite_clnt: local: [email protected] -> [email protected] smtp_1_dd4911cb7d82 | postfix/smtpd[481]: send attr request = rewrite smtp_1_dd4911cb7d82 | postfix/smtpd[481]: send attr rule = local smtp_1_dd4911cb7d82 | postfix/smtpd[481]: send attr address = testfoo+bar@XXXX smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: master_notify: status 0 smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: rewrite socket: wanted attribute: request smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute name: request smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute value: rewrite smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: rewrite socket: wanted attribute: rule smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute name: rule smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute value: local smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: rewrite socket: wanted attribute: address admin_1_32aa1309eb8f | 172.31.0.12 - - [26/Dec/2018:21:54:06 +0000] "GET /internal/postfix/domain/XXXX HTTP/1.1" 200 12 "-" "Python/3.6 aiohttp/3.5.1" smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute name: address smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute value: testfoo+bar@XXXX smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: rewrite socket: wanted attribute: (list terminator) smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute name: (end) smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: `local' `testfoo+bar@XXXX' -> `testfoo+bar@XXXX' smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: send attr flags = 0 smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: send attr address = testfoo+bar@XXXX smtp_1_dd4911cb7d82 | postfix/smtpd[481]: private/rewrite socket: wanted attribute: flags smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute name: flags smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute value: 0 smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: master_notify: status 1 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: private/rewrite socket: wanted attribute: address smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute name: address smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute value: testfoo+bar@XXXX smtp_1_dd4911cb7d82 | postfix/smtpd[481]: private/rewrite socket: wanted attribute: (list terminator) smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute name: (end) smtp_1_dd4911cb7d82 | postfix/smtpd[481]: rewrite_clnt: local: testfoo+bar@XXXX -> testfoo+bar@XXXX smtp_1_dd4911cb7d82 | postfix/smtpd[481]: send attr request = resolve smtp_1_dd4911cb7d82 | postfix/smtpd[481]: send attr sender = [email protected] smtp_1_dd4911cb7d82 | postfix/smtpd[481]: send attr address = testfoo+bar@XXXX smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: master_notify: status 0 smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: rewrite socket: wanted attribute: request smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute name: request smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute value: resolve smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: rewrite socket: wanted attribute: sender smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute name: sender smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute value: [email protected] smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: rewrite socket: wanted attribute: address smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute name: address smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute value: testfoo+bar@XXXX smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: rewrite socket: wanted attribute: (list terminator) smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: input attribute name: (end) smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: match_list_match: XXXX: no match smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: match_string: virtual_mailbox_domains: XXXX ~? socketmap:unix:/tmp/podop.socket:domain(0,lock|utf8_request) smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: dict_sockmap_lookup: key XXXX smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: match_hostname: relay_domains: XXXX ~? socketmap:unix:/tmp/podop.socket:transport(0,lock|utf8_request) smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: dict_sockmap_lookup: key XXXX admin_1_32aa1309eb8f | 172.31.0.12 - - [26/Dec/2018:21:54:06 +0000] "GET /internal/postfix/transport/XXXX HTTP/1.1" 404 233 "-" "Python/3.6 aiohttp/3.5.1" smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: match_list_match: XXXX: no match smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: dict_sockmap_lookup: key testfoo+bar@XXXX admin_1_32aa1309eb8f | 172.31.0.12 - - [26/Dec/2018:21:54:06 +0000] "GET /internal/postfix/transport/testfoo+bar@XXXX HTTP/1.1" 404 233 "-" "Python/3.6 aiohttp/3.5.1" smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: maps_find: transport_maps: testfoo+bar@XXXX: not found smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: maps_find: transport_maps: testfoo@XXXX: not found smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: maps_find: transport_maps: XXXX: not found smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: maps_find: transport_maps: .en.it: not found smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: maps_find: transport_maps: .it: not found smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: mail_addr_find: testfoo+bar@XXXX -> (not found) smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: `[email protected]' -> `testfoo+bar@XXXX' -> (`lmtp' `inet:imap:2525' `testfoo+bar@XXXX' `1024') smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: send attr flags = 0 smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: send attr transport = lmtp smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: send attr nexthop = inet:imap:2525 smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: send attr recipient = testfoo+bar@XXXX smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: send attr flags = 1024 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: private/rewrite socket: wanted attribute: flags smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute name: flags smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute value: 0 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: private/rewrite socket: wanted attribute: transport smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute name: transport smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute value: lmtp smtp_1_dd4911cb7d82 | postfix/smtpd[481]: private/rewrite socket: wanted attribute: nexthop smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute name: nexthop smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute value: inet:imap:2525 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: private/rewrite socket: wanted attribute: recipient smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute name: recipient smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute value: testfoo+bar@XXXX smtp_1_dd4911cb7d82 | postfix/smtpd[481]: private/rewrite socket: wanted attribute: flags smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute name: flags smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute value: 1024 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: private/rewrite socket: wanted attribute: (list terminator) smtp_1_dd4911cb7d82 | postfix/smtpd[481]: input attribute name: (end) smtp_1_dd4911cb7d82 | postfix/smtpd[481]: resolve_clnt: `[email protected]' -> `testfoo+bar@XXXX' -> transp=`lmtp' host=`inet:imap:2525' rcpt=`testfoo+bar@XXXX' flags= class=virtual smtp_1_dd4911cb7d82 | postfix/smtpd[481]: ctable_locate: install entry key [email protected]?testfoo+bar@XXXX smtp_1_dd4911cb7d82 | postfix/smtpd[481]: extract_addr: in: <testfoo+bar@XXXX>, result: testfoo+bar@XXXX smtp_1_dd4911cb7d82 | postfix/smtpd[481]: >>> START Client host RESTRICTIONS <<< smtp_1_dd4911cb7d82 | postfix/smtpd[481]: generic_checks: name=permit_mynetworks smtp_1_dd4911cb7d82 | postfix/smtpd[481]: permit_mynetworks: unknown 172.31.0.1 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_hostname: mynetworks: unknown ~? 127.0.0.1/32 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_hostaddr: mynetworks: 172.31.0.1 ~? 127.0.0.1/32 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_hostname: mynetworks: unknown ~? [::1]/128 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_hostaddr: mynetworks: 172.31.0.1 ~? [::1]/128 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_hostname: mynetworks: unknown ~? 172.31.0.0/24 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_hostaddr: mynetworks: 172.31.0.1 ~? 172.31.0.0/24 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: smtpd_acl_permit: checking smtpd_log_access_permit_actions settings smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_list_match: permit_mynetworks: no match smtp_1_dd4911cb7d82 | postfix/smtpd[481]: smtpd_acl_permit: smtpd_log_access_permit_actions: no match smtp_1_dd4911cb7d82 | postfix/smtpd[481]: generic_checks: name=permit_mynetworks status=1 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: >>> END Client host RESTRICTIONS <<< smtp_1_dd4911cb7d82 | postfix/smtpd[481]: >>> START Recipient address RESTRICTIONS <<< smtp_1_dd4911cb7d82 | postfix/smtpd[481]: generic_checks: name=permit_mynetworks smtp_1_dd4911cb7d82 | postfix/smtpd[481]: permit_mynetworks: unknown 172.31.0.1 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_hostname: mynetworks: unknown ~? 127.0.0.1/32 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_hostaddr: mynetworks: 172.31.0.1 ~? 127.0.0.1/32 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_hostname: mynetworks: unknown ~? [::1]/128 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_hostaddr: mynetworks: 172.31.0.1 ~? [::1]/128 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_hostname: mynetworks: unknown ~? 172.31.0.0/24 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_hostaddr: mynetworks: 172.31.0.1 ~? 172.31.0.0/24 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: smtpd_acl_permit: checking smtpd_log_access_permit_actions settings smtp_1_dd4911cb7d82 | postfix/smtpd[481]: match_list_match: permit_mynetworks: no match smtp_1_dd4911cb7d82 | postfix/smtpd[481]: smtpd_acl_permit: smtpd_log_access_permit_actions: no match smtp_1_dd4911cb7d82 | postfix/smtpd[481]: generic_checks: name=permit_mynetworks status=1 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: >>> END Recipient address RESTRICTIONS <<< smtp_1_dd4911cb7d82 | postfix/smtpd[481]: >>> CHECKING Recipient address VALIDATION MAPS <<< smtp_1_dd4911cb7d82 | postfix/smtpd[481]: ctable_locate: leave existing entry key [email protected]?testfoo+bar@XXXX smtp_1_dd4911cb7d82 | postfix/smtpd[481]: maps_find: recipient_canonical_maps: testfoo+bar@XXXX: not found smtp_1_dd4911cb7d82 | postfix/smtpd[481]: maps_find: recipient_canonical_maps: testfoo@XXXX: not found smtp_1_dd4911cb7d82 | postfix/smtpd[481]: maps_find: recipient_canonical_maps: testfoo+bar: not found smtp_1_dd4911cb7d82 | postfix/smtpd[481]: maps_find: recipient_canonical_maps: testfoo: not found smtp_1_dd4911cb7d82 | postfix/smtpd[481]: maps_find: recipient_canonical_maps: @XXXX: not found smtp_1_dd4911cb7d82 | postfix/smtpd[481]: mail_addr_find: testfoo+bar@XXXX -> (not found) smtp_1_dd4911cb7d82 | postfix/smtpd[481]: maps_find: canonical_maps: testfoo+bar@XXXX: not found smtp_1_dd4911cb7d82 | postfix/smtpd[481]: maps_find: canonical_maps: testfoo@XXXX: not found smtp_1_dd4911cb7d82 | postfix/smtpd[481]: maps_find: canonical_maps: testfoo+bar: not found smtp_1_dd4911cb7d82 | postfix/smtpd[481]: maps_find: canonical_maps: testfoo: not found smtp_1_dd4911cb7d82 | postfix/smtpd[481]: maps_find: canonical_maps: @XXXX: not found smtp_1_dd4911cb7d82 | postfix/smtpd[481]: mail_addr_find: testfoo+bar@XXXX -> (not found) smtp_1_dd4911cb7d82 | postfix/smtpd[481]: dict_sockmap_lookup: key testfoo+bar@XXXX smtp_1_dd4911cb7d82 | postfix/smtpd[481]: auto_clnt_open: connected to /tmp/podop.socket smtp_1_dd4911cb7d82 | postfix/trivial-rewrite[483]: master_notify: status 1 admin_1_32aa1309eb8f | 172.31.0.12 - - [26/Dec/2018:21:54:06 +0000] "GET /internal/postfix/alias/testfoo+bar@XXXX HTTP/1.1" 404 233 "-" "Python/3.6 aiohttp/3.5.1" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: maps_find: virtual_alias_maps: testfoo+bar@XXXX: not found smtp_1_dd4911cb7d82 | postfix/smtpd[481]: maps_find: virtual_alias_maps: testfoo@XXXX: not found smtp_1_dd4911cb7d82 | postfix/smtpd[481]: maps_find: virtual_alias_maps: testfoo+bar: not found smtp_1_dd4911cb7d82 | postfix/smtpd[481]: maps_find: virtual_alias_maps: testfoo: not found smtp_1_dd4911cb7d82 | postfix/smtpd[481]: maps_find: virtual_alias_maps: @XXXX: not found smtp_1_dd4911cb7d82 | postfix/smtpd[481]: mail_addr_find: testfoo+bar@XXXX -> (not found) smtp_1_dd4911cb7d82 | postfix/smtpd[481]: dict_sockmap_lookup: key testfoo+bar@XXXX admin_1_32aa1309eb8f | 172.31.0.12 - - [26/Dec/2018:21:54:06 +0000] "GET /internal/postfix/mailbox/testfoo+bar@XXXX HTTP/1.1" 404 233 "-" "Python/3.6 aiohttp/3.5.1" smtp_1_dd4911cb7d82 | postfix/smtpd[481]: maps_find: virtual_mailbox_maps: testfoo+bar@XXXX: not found smtp_1_dd4911cb7d82 | postfix/smtpd[481]: maps_find: virtual_mailbox_maps: testfoo@XXXX: not found smtp_1_dd4911cb7d82 | postfix/smtpd[481]: maps_find: virtual_mailbox_maps: testfoo+bar: not found smtp_1_dd4911cb7d82 | postfix/smtpd[481]: maps_find: virtual_mailbox_maps: testfoo: not found smtp_1_dd4911cb7d82 | postfix/smtpd[481]: maps_find: virtual_mailbox_maps: @XXXX: not found smtp_1_dd4911cb7d82 | postfix/smtpd[481]: mail_addr_find: testfoo+bar@XXXX -> (not found) smtp_1_dd4911cb7d82 | postfix/smtpd[481]: NOQUEUE: reject: RCPT from unknown[172.31.0.1]: 550 5.1.1 <testfoo+bar@XXXX>: Recipient address rejected: User unknown in virtual mailbox table; from=<[email protected]> to=<testfoo+bar@XXXX> proto=ESMTP helo=<sending.doma.in> smtp_1_dd4911cb7d82 | postfix/smtpd[481]: report recipient to all milters (flags=0x1) smtp_1_dd4911cb7d82 | postfix/smtpd[481]: > unknown[172.31.0.1]: 550 5.1.1 <testfoo+bar@XXXX>: Recipient address rejected: User unknown in virtual mailbox table smtp_1_dd4911cb7d82 | postfix/smtpd[481]: < unknown[172.31.0.1]: QUIT smtp_1_dd4911cb7d82 | postfix/smtpd[481]: > unknown[172.31.0.1]: 221 2.0.0 Bye smtp_1_dd4911cb7d82 | postfix/smtpd[481]: abort all milters smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter8_abort: abort milter inet:antispam:11332 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: abort all milters smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter8_abort: abort milter inet:antispam:11332 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: disconnect event to all milters smtp_1_dd4911cb7d82 | postfix/smtpd[481]: milter8_disc_event: quit milter inet:antispam:11332 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: disconnect from unknown[172.31.0.1] ehlo=1 mail=1 rcpt=0/1 quit=1 commands=3/4 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: free all milters smtp_1_dd4911cb7d82 | postfix/smtpd[481]: free milter inet:antispam:11332 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: master_notify: status 1 smtp_1_dd4911cb7d82 | postfix/smtpd[481]: connection closed ``` Does a trace of all postfix processes set to `-v` help? For conveniently reading through it without having to fiddle your setup โ€ฆ.
2018-12-27T15:23:39
Mailu/Mailu
811
Mailu__Mailu-811
[ "776" ]
3b5f3af20771fce3d15bd485686003ab8e6c37f8
diff --git a/core/dovecot/start.py b/core/dovecot/start.py --- a/core/dovecot/start.py +++ b/core/dovecot/start.py @@ -33,5 +33,6 @@ def start_podop(): # Run Podop, then postfix multiprocessing.Process(target=start_podop).start() -os.system("chown -R mail:mail /mail /var/lib/dovecot /conf") +os.system("chown mail:mail /mail") +os.system("chown -R mail:mail /var/lib/dovecot /conf") os.execv("/usr/sbin/dovecot", ["dovecot", "-c", "/etc/dovecot/dovecot.conf", "-F"])
Dovecot service takes long to start ``` docker stack ps mailu ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS yh6u3jrckt32 mailu_redis.1 redis:alpine prod02.usrpro.com Running Running 4 minutes ago otpt6os15sy3 mailu_smtp.1 mailu/postfix:master prod01.usrpro.com Running Running 4 minutes ago artmzgamypoy mailu_webdav.1 mailu/radicale:master prod03.usrpro.com Running Running 4 minutes ago x5ynw6h5ap3p mailu_imap.1 usrpro/dovecot:workaround-lucene prod03.usrpro.com Running Starting 4 minutes ago n674xs649jlw mailu_admin.1 mailu/admin:master prod01.usrpro.com Running Running 4 minutes ago xrmri5cqjzqn mailu_antivirus.1 mailu/clamav:master prod02.usrpro.com Running Running 2 minutes ago koiuyxlj2cpt mailu_antispam.1 mailu/rspamd:master prod03.usrpro.com Running Running 4 minutes ago hdpu4gq182ha mailu_webmail.1 mailu/rainloop:master prod01.usrpro.com Running Running 4 minutes ago wgqkwnz6wyxp mailu_front.1 mailu/nginx:master prod01.usrpro.com Running Running 4 minutes ago v2eznworzs0g mailu_front.2 mailu/nginx:master prod02.usrpro.com Running Running 4 minutes ago nckm82d8aryd mailu_front.3 mailu/nginx:master prod03.usrpro.com Running Running 4 minutes ago ``` In `start.py`, most probably it is stuck on: ``` multiprocessing.Process(target=start_podop).start() ``` Have to confirm with writing some logging, like requested in issue #588 .
It's probably dh-param againโ€ฆ :roll_eyes: see https://wiki2.dovecot.org/SSL/DovecotConfiguration#SSL_security_settings Quote: > When Dovecot starts up for the first time, it generates new 512bit and 1024bit Diffie Hellman parameters and saves them into /var/lib/dovecot/ssl-parameters.dat So dh-params get generated and saved inside the volatile container which is gone once the container is re-created Ooh, damn. That;s a good one. It's the middle of the night and I've just given up on swarm, destroyed the stack and went back to compose, only to find out that the problem still appears (using one of the same host). Already started to suspect the VM environment of freezing up podop's asyncio. Unfortunately I've missed this message, since I'm lucky enough this issue affects only my production servers. Thanks for the tip. I'll look into this in the morning... I've mounted /var/lib/dovecot and found no generated ssh-parameters.dat. Probably because we don't use ssl in dovecot? Instead, I found that `chown -R` is the guilty one. It is recursively changing ownership of all the mailboxes, which are stored on glusterfs. Ouch! This explains why I'm seeing this problem getting bigger over time: more mails in the mailboxes. Easy fix though...
2019-01-08T03:03:03
Mailu/Mailu
812
Mailu__Mailu-812
[ "789" ]
4204facd85667dbad8f76fc0235963eda971da65
diff --git a/core/admin/mailu/ui/forms.py b/core/admin/mailu/ui/forms.py --- a/core/admin/mailu/ui/forms.py +++ b/core/admin/mailu/ui/forms.py @@ -165,11 +165,11 @@ class FetchForm(flask_wtf.FlaskForm): protocol = fields.SelectField(_('Protocol'), choices=[ ('imap', 'IMAP'), ('pop3', 'POP3') ]) - host = fields.StringField(_('Hostname or IP')) - port = fields.IntegerField(_('TCP port')) + host = fields.StringField(_('Hostname or IP'), [validators.DataRequired()]) + port = fields.IntegerField(_('TCP port'), [validators.DataRequired(), validators.NumberRange(min=0, max=65535)]) tls = fields.BooleanField(_('Enable TLS')) - username = fields.StringField(_('Username')) - password = fields.StringField(_('Password')) + username = fields.StringField(_('Username'), [validators.DataRequired()]) + password = fields.PasswordField(_('Password'), [validators.DataRequired()]) keep = fields.BooleanField(_('Keep emails on the server')) submit = fields.SubmitField(_('Submit'))
Password field(s) of type "text" instead of "password" In 1.5 [this line](https://github.com/Mailu/Mailu/blob/master/core/admin/mailu/ui/templates/fetch/create.html#L22) creates a field of type _text_ not _password_.
2019-01-08T18:46:31
Mailu/Mailu
814
Mailu__Mailu-814
[ "813" ]
4204facd85667dbad8f76fc0235963eda971da65
diff --git a/core/admin/mailu/models.py b/core/admin/mailu/models.py --- a/core/admin/mailu/models.py +++ b/core/admin/mailu/models.py @@ -261,14 +261,20 @@ def resolve_domain(cls, email): @classmethod def resolve_destination(cls, localpart, domain_name, ignore_forward_keep=False): localpart_stripped = None + stripped_alias = None + if os.environ.get('RECIPIENT_DELIMITER') in localpart: localpart_stripped = localpart.rsplit(os.environ.get('RECIPIENT_DELIMITER'), 1)[0] - alias = Alias.resolve(localpart, domain_name) - if not alias and localpart_stripped: - alias = Alias.resolve(localpart_stripped, domain_name) - if alias: - return alias.destination + pure_alias = Alias.resolve(localpart, domain_name) + stripped_alias = Alias.resolve(localpart_stripped, domain_name) + + if pure_alias and not pure_alias.wildcard: + return pure_alias.destination + elif stripped_alias: + return stripped_alias.destination + elif pure_alias: + return pure_alias.destination user = User.query.get('{}@{}'.format(localpart, domain_name)) if not user and localpart_stripped:
Wildcard aliases override concrete aliases + delimiter After #778 , the following scenario behaved in a non-intuitive way: Aliases: * `[email protected]` โ‡’ user**A** * `%@xxx.tld` โ‡’ user**B** Sending to both `[email protected]` and `[email protected]` work, however `[email protected]` gets delivered to user**B**. This is not intuitive to the user.
2019-01-09T10:42:05
Mailu/Mailu
816
Mailu__Mailu-816
[ "745" ]
fa1e4b80231e4d52485b0d257227a02f31a48ac8
diff --git a/core/admin/mailu/ui/forms.py b/core/admin/mailu/ui/forms.py --- a/core/admin/mailu/ui/forms.py +++ b/core/admin/mailu/ui/forms.py @@ -84,7 +84,7 @@ class RelayForm(flask_wtf.FlaskForm): class UserForm(flask_wtf.FlaskForm): localpart = fields.StringField(_('E-mail'), [validators.DataRequired(), validators.Regexp(LOCALPART_REGEX)]) - pw = fields.PasswordField(_('Password'), [validators.DataRequired()]) + pw = fields.PasswordField(_('Password')) pw2 = fields.PasswordField(_('Confirm password'), [validators.EqualTo('pw')]) quota_bytes = fields_.IntegerSliderField(_('Quota'), default=1000000000) enable_imap = fields.BooleanField(_('Allow IMAP access'), default=True) diff --git a/core/admin/mailu/ui/views/users.py b/core/admin/mailu/ui/views/users.py --- a/core/admin/mailu/ui/views/users.py +++ b/core/admin/mailu/ui/views/users.py @@ -23,6 +23,7 @@ def user_create(domain_name): return flask.redirect( flask.url_for('.user_list', domain_name=domain.name)) form = forms.UserForm() + form.pw.validators = [wtforms.validators.DataRequired()] if domain.max_quota_bytes: form.quota_bytes.validators = [ wtforms.validators.NumberRange(max=domain.max_quota_bytes)] @@ -54,7 +55,6 @@ def user_edit(user_email): # Create the form form = forms.UserForm(obj=user) wtforms_components.read_only(form.localpart) - form.pw.validators = [] form.localpart.validators = [] if max_quota_bytes: form.quota_bytes.validators = [
In user-admin for a domain, allow changing user fields without changing the password Hi, in https://github.com/Mailu/Mailu/blob/a382f74680a749762cc14272c2b023cdd52ba1fd/core/admin/mailu/ui/forms.py#L79 it seems the password+confirm password field is always required. However, when modifying a user (e.g. changing their quota, disabling pop3, etc) itโ€™s useful to be able to carry out these modifications without resetting the users password โ€ฆ. For this, itโ€™d be great if a left-blank field would be just ignored, and the password in the model not touched.
Strange thing is that this should drop the constraint. https://github.com/Mailu/Mailu/blob/be7dc1e6bd122c783805d1c647d9ceb03887b595/core/admin/mailu/ui/views/users.py#L58 I will look again into that in the morning. Hi, isnโ€™t that the validator thatโ€™s run for handling a POST request server-sided? What I observed is that a client-side validator in the browser prohibits empty input before an actual request is issued. Thanks for looking into this, -Dario Just hit this on a fresh 'master' install in preparation for the 1.6 release. Should probably be in the milestone for that?
2019-01-09T11:10:49
Mailu/Mailu
826
Mailu__Mailu-826
[ "815" ]
f2bc441e9ef1e4e8d83803ff8ba10c33ea589334
diff --git a/core/admin/mailu/models.py b/core/admin/mailu/models.py --- a/core/admin/mailu/models.py +++ b/core/admin/mailu/models.py @@ -266,16 +266,6 @@ def resolve_destination(cls, localpart, domain_name, ignore_forward_keep=False): if os.environ.get('RECIPIENT_DELIMITER') in localpart: localpart_stripped = localpart.rsplit(os.environ.get('RECIPIENT_DELIMITER'), 1)[0] - pure_alias = Alias.resolve(localpart, domain_name) - stripped_alias = Alias.resolve(localpart_stripped, domain_name) - - if pure_alias and not pure_alias.wildcard: - return pure_alias.destination - elif stripped_alias: - return stripped_alias.destination - elif pure_alias: - return pure_alias.destination - user = User.query.get('{}@{}'.format(localpart, domain_name)) if not user and localpart_stripped: user = User.query.get('{}@{}'.format(localpart_stripped, domain_name)) @@ -288,6 +278,16 @@ def resolve_destination(cls, localpart, domain_name, ignore_forward_keep=False): destination = [user.email] return destination + pure_alias = Alias.resolve(localpart, domain_name) + stripped_alias = Alias.resolve(localpart_stripped, domain_name) + + if pure_alias and not pure_alias.wildcard: + return pure_alias.destination + elif stripped_alias: + return stripped_alias.destination + elif pure_alias: + return pure_alias.destination + def __str__(self): return self.email
Configuration (or hardcode) to rank users higher than aliases Currently, when resolving the localpart of a domain, `admin` first tries aliases, and if no alias is found, users are searched: ``` alias = Alias.resolve(localpart, domain_name) if not alias and localpart_stripped: alias = Alias.resolve(localpart_stripped, domain_name) if alias: return alias.destination user = User.query.get('{}@{}'.format(localpart, domain_name)) if not user and localpart_stripped: user = User.query.get('{}@{}'.format(localpart_stripped, domain_name)) if user: if user.forward_enabled: destination = user.forward_destination if user.forward_keep or ignore_forward_keep: destination.append(user.email) else: destination = [user.email] return destination ``` This may be counter-intuitive to some users: After all, wildcards often behave the way that they are considered only after all more-specific options are considered and dismissed. Here, itโ€™s vice-versa: If thereโ€™s a catchall alias (`%@xxx.tld`), then all users under `xxx.tld` are not reachable anymore. One use-case that is not possible here would be: A domain-owner would like catchall for himself, but give specific names to services, relatives, friends, etc.: The only workaround for this is currently to create these accounts on another domain, and then create an alias on `xxx.tld` to them. Since changing the behavior of that function might break existing users setups, Iโ€™d follow the suggestion of `braintopping` from matrix: Using a kind of feature-flag or configuration variable to switch the behavior of preferring users vs. preferring aliases. What does everyone think about that? Iโ€™d be grateful for some feedback~.
I don't like the idea of an configuration variable. It makes it unnecessary complicated and confuses people. Furthermore this behavior was introduced with the new `feat-abstract-db` only on master a few month ago. So I suggest we just change it. You do have a point there โ€” with such behavioral feature-flags, they can become a lot and quite confusing quickly. I made 2 example of how this could look like in the branches github kindly linked above. I canโ€™t PR them yet because the only make sense based off https://github.com/Mailu/Mailu/pull/814 โ€” so Iโ€™ll wait until that oneโ€™s in. If you want to have a look at them beforehand, please go ahead ^_^. Thanks!
2019-01-11T14:10:54
Mailu/Mailu
831
Mailu__Mailu-831
[ "830" ]
9175b15d4902e6846b5e4656547bd902232eaad0
diff --git a/core/admin/mailu/configuration.py b/core/admin/mailu/configuration.py --- a/core/admin/mailu/configuration.py +++ b/core/admin/mailu/configuration.py @@ -30,11 +30,11 @@ 'POSTMASTER': 'postmaster', 'TLS_FLAVOR': 'cert', 'AUTH_RATELIMIT': '10/minute;1000/hour', - 'DISABLE_STATISTICS': 'False', + 'DISABLE_STATISTICS': False, # Mail settings 'DMARC_RUA': None, 'DMARC_RUF': None, - 'WELCOME': 'False', + 'WELCOME': False, 'WELCOME_SUBJECT': 'Dummy welcome topic', 'WELCOME_BODY': 'Dummy welcome body', 'DKIM_SELECTOR': 'dkim', @@ -74,13 +74,21 @@ class ConfigManager(dict): def __init__(self): self.config = dict() + def __coerce_value(self, value): + if isinstance(value, str) and value.lower() in ('true','yes'): + return True + elif isinstance(value, str) and value.lower() in ('false', 'no'): + return False + return value + def init_app(self, app): self.config.update(app.config) # get environment variables self.config.update({ - key: os.environ.get(key, value) + key: self.__coerce_value(os.environ.get(key, value)) for key, value in DEFAULT_CONFIG.items() }) + # automatically set the sqlalchemy string if self.config['DB_FLAVOR']: template = self.DB_TEMPLATES[self.config['DB_FLAVOR']] diff --git a/core/admin/mailu/manage.py b/core/admin/mailu/manage.py --- a/core/admin/mailu/manage.py +++ b/core/admin/mailu/manage.py @@ -31,7 +31,7 @@ def advertise(): instance_id = str(uuid.uuid4()) with open(app.config["INSTANCE_ID_PATH"], "w") as handle: handle.write(instance_id) - if app.config["DISABLE_STATISTICS"].lower() != "true": + if not app.config["DISABLE_STATISTICS"]: try: socket.gethostbyname(app.config["STATS_ENDPOINT"].format(instance_id)) except: diff --git a/core/admin/mailu/models.py b/core/admin/mailu/models.py --- a/core/admin/mailu/models.py +++ b/core/admin/mailu/models.py @@ -410,7 +410,7 @@ def get_managed_emails(self, include_aliases=True): return emails def send_welcome(self): - if app.config["WELCOME"].lower() == "true": + if app.config["WELCOME"]: self.sendmail(app.config["WELCOME_SUBJECT"], app.config["WELCOME_BODY"])
With DOMAIN_REGISTRATION set to `false`, the registration ui is enabled Looks like it doesnโ€™t matter what itโ€™s set to โ€” as long as its string pythonically evaluates to `True`, itโ€™ll be shown. Thatโ€™s AFAIK every string not `""`, right? That said, itโ€™s probably true for many other Boolean config flags, as no data-type aware casting is done in `core/admin/mailu/configuration.py`. Maybe a more general solution would be nice?
2019-01-13T09:23:57
Mailu/Mailu
834
Mailu__Mailu-834
[ "829" ]
e80a7a1228426fe137d17d7c9c26d9ede41c8c92
diff --git a/core/admin/mailu/ui/forms.py b/core/admin/mailu/ui/forms.py --- a/core/admin/mailu/ui/forms.py +++ b/core/admin/mailu/ui/forms.py @@ -137,7 +137,7 @@ class TokenForm(flask_wtf.FlaskForm): raw_password = fields.HiddenField([validators.DataRequired()]) comment = fields.StringField(_('Comment')) ip = fields.StringField( - _('Authorized IP'), [validators.Optional(), validators.IPAddress()] + _('Authorized IP'), [validators.Optional(), validators.IPAddress(ipv6=True)] ) submit = fields.SubmitField(_('Save'))
Cannot create an Authorisation Token for an IPv6 address On `/admin/ui/token/create` when one enters an IPv6 address it responds with "invalid ip address" because wtforms.validators.IPAddress understands IPv4 only. I'm also not sure if the other parts that handle auth tokens support IPv6.
2019-01-13T15:49:53
Mailu/Mailu
837
Mailu__Mailu-837
[ "818" ]
fd15a5b65ca87a46d14d320968bce0cd145c1fb3
diff --git a/core/admin/mailu/ui/forms.py b/core/admin/mailu/ui/forms.py --- a/core/admin/mailu/ui/forms.py +++ b/core/admin/mailu/ui/forms.py @@ -37,7 +37,7 @@ def __init__(self,message=_('Invalid email address.')): self.message = message def __call__(self, form, field): - pattern = re.compile(r'^([_a-z0-9\-]+)(\.[_a-z0-9\-]+)*@([a-z0-9\-]{2,}\.)*([a-z]{2,4})(,([_a-z0-9\-]+)(\.[_a-z0-9\-]+)*@([a-z0-9\-]{2,}\.)*([a-z]{2,4}))*$') + pattern = re.compile(r'^([_a-z0-9\-]+)(\.[_a-z0-9\-]+)*@([a-z0-9\-]{2,}\.)*([a-z]{2,})(,([_a-z0-9\-]+)(\.[_a-z0-9\-]+)*@([a-z0-9\-]{2,}\.)*([a-z]{2,}))*$') if not pattern.match(field.data.replace(" ", "")): raise validators.ValidationError(self.message)
Auto-forward email validation bug Getting `Invalid email address` when trying to set auto-forward destination to [email protected]. Following the code i got to this regex which i think does the trick. https://github.com/Mailu/Mailu/blob/fa1e4b80231e4d52485b0d257227a02f31a48ac8/core/admin/mailu/ui/forms.py#L40
2019-01-15T12:23:20
Mailu/Mailu
840
Mailu__Mailu-840
[ "760" ]
6dea8b422a525f1cf03d1afc181128cae2050635
diff --git a/setup/server.py b/setup/server.py --- a/setup/server.py +++ b/setup/server.py @@ -11,7 +11,7 @@ import hashlib -version = os.getenv("this_version") +version = os.getenv("this_version", "master") static_url_path = "/" + version + "/static" app = flask.Flask(__name__, static_url_path=static_url_path) flask_bootstrap.Bootstrap(app)
Document the new setup utility Title says all
2019-01-16T19:03:40
Mailu/Mailu
850
Mailu__Mailu-850
[ "846" ]
e80a7a1228426fe137d17d7c9c26d9ede41c8c92
diff --git a/core/admin/mailu/internal/views/postfix.py b/core/admin/mailu/internal/views/postfix.py --- a/core/admin/mailu/internal/views/postfix.py +++ b/core/admin/mailu/internal/views/postfix.py @@ -49,5 +49,18 @@ def postfix_sender_login(sender): def postfix_sender_access(sender): """ Simply reject any sender that pretends to be from a local domain """ - localpart, domain_name = models.Email.resolve_domain(sender) - return flask.jsonify("REJECT") if models.Domain.query.get(domain_name) else flask.abort(404) + if not is_void_address(sender): + localpart, domain_name = models.Email.resolve_domain(sender) + return flask.jsonify("REJECT") if models.Domain.query.get(domain_name) else flask.abort(404) + else: + return flask.abort(404) + + +def is_void_address(email): + '''True if the email is void (null) email address. + ''' + if email.startswith('<') and email.endswith('>'): + email = email[1:-1] + # Some MTAs use things like '<MAILER-DAEMON>' instead of '<>'; so let's + # consider void any such thing. + return '@' not in email
Sender access fails with void addresses Some MTA send bounces and or notifications using an empty address `MAIL FROM: <>`; this causes an error in the route `/internal/postfix/sender/access`: ``` [2019-01-18 21:23:32,211] ERROR in app: Exception on /internal/postfix/sender/access/<> [GET] Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/idna/core.py", line 271, in alabel ulabel(label) File "/usr/lib/python3.6/site-packages/idna/core.py", line 307, in ulabel check_label(label) File "/usr/lib/python3.6/site-packages/idna/core.py", line 261, in check_label raise InvalidCodepoint('Codepoint {0} at position {1} of {2} not allowed'.format(_unot(cp_value), pos+1, repr(label))) idna.core.InvalidCodepoint: Codepoint U+003C at position 1 of '<>' not allowed During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1127, in _execute_context context = constructor(dialect, self, conn, *args) File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 669, in _init_compiled param.append(processors[key](compiled_params[key])) File "/usr/lib/python3.6/site-packages/sqlalchemy/sql/type_api.py", line 1182, in process return process_param(value, dialect) File "/app/mailu/models.py", line 30, in process_bind_param return idna.encode(value).decode("ascii").lower() File "/usr/lib/python3.6/site-packages/idna/core.py", line 361, in encode s = alabel(label) File "/usr/lib/python3.6/site-packages/idna/core.py", line 273, in alabel raise IDNAError('The label {0} is not a valid A-label'.format(label)) idna.core.IDNAError: The label b'<>' is not a valid A-label The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app response = self.full_dispatch_request() File "/usr/lib/python3.6/site-packages/flask/app.py", line 1815, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/lib/python3.6/site-packages/flask/app.py", line 1718, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise raise value File "/usr/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request rv = self.dispatch_request() File "/usr/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/app/mailu/internal/views/postfix.py", line 52, in postfix_sender_access localpart, domain_name = models.Email.resolve_domain(sender) File "/app/mailu/models.py", line 263, in resolve_domain alternative = Alternative.query.get(domain_name) File "/usr/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 924, in get ident, loading.load_on_pk_identity) File "/usr/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 1007, in _get_impl return db_load_fn(self, primary_key_identity) File "/usr/lib/python3.6/site-packages/sqlalchemy/orm/loading.py", line 250, in load_on_pk_identity return q.one() File "/usr/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 2954, in one ret = self.one_or_none() File "/usr/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 2924, in one_or_none ret = list(self) File "/usr/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 2995, in __iter__ return self._execute_and_instances(context) File "/usr/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 3018, in _execute_and_instances result = conn.execute(querycontext.statement, self._params) File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 948, in execute return meth(self, multiparams, params) File "/usr/lib/python3.6/site-packages/sqlalchemy/sql/elements.py", line 269, in _execute_on_connection return connection._execute_clauseelement(self, multiparams, params) File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1060, in _execute_clauseelement compiled_sql, distilled_params File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1132, in _execute_context None, None) File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1413, in _handle_dbapi_exception exc_info File "/usr/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 265, in raise_from_cause reraise(type(exception), exception, tb=exc_tb, cause=cause) File "/usr/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 248, in reraise raise value.with_traceback(tb) File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1127, in _execute_context context = constructor(dialect, self, conn, *args) File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 669, in _init_compiled param.append(processors[key](compiled_params[key])) File "/usr/lib/python3.6/site-packages/sqlalchemy/sql/type_api.py", line 1182, in process return process_param(value, dialect) File "/app/mailu/models.py", line 30, in process_bind_param return idna.encode(value).decode("ascii").lower() File "/usr/lib/python3.6/site-packages/idna/core.py", line 361, in encode s = alabel(label) File "/usr/lib/python3.6/site-packages/idna/core.py", line 273, in alabel raise IDNAError('The label {0} is not a valid A-label'.format(label)) sqlalchemy.exc.StatementError: (idna.core.IDNAError) The label b'<>' is not a valid A-label ... 172.17.0.35 - - [18/Jan/2019:21:23:32 +0000] "GET /internal/postfix/sender/access/%3C%3E HTTP/1.1" 500 291 "-" "Python/3.6 aiohttp/3.5.4" ```
2019-01-19T11:47:38
Mailu/Mailu
876
Mailu__Mailu-876
[ "869" ]
343ae8be49430683ffb7f744f52a250c835736ce
diff --git a/core/admin/mailu/manage.py b/core/admin/mailu/manage.py --- a/core/admin/mailu/manage.py +++ b/core/admin/mailu/manage.py @@ -292,8 +292,9 @@ def alias_delete(email): @click.argument('localpart') @click.argument('domain_name') @click.argument('destination') [email protected]('-w', '--wildcard', is_flag=True) @flask_cli.with_appcontext -def alias(localpart, domain_name, destination): +def alias(localpart, domain_name, destination, wildcard=False): """ Create an alias """ domain = models.Domain.query.get(domain_name) @@ -303,6 +304,7 @@ def alias(localpart, domain_name, destination): alias = models.Alias( localpart=localpart, domain=domain, + wildcard=wildcard, destination=destination.split(','), email="%s@%s" % (localpart, domain_name) )
Missing wildcard option in alias flask command Hi guys, First of all, thank you for making this awesome Mailu project :+1: :100: I'm using command line to mass import some alias from an old server. There doesn't seem to have an option to toggle wildcard support: ``` Usage: flask mailu alias [OPTIONS] LOCALPART DOMAIN_NAME DESTINATION Create an alias Options: --help Show this message and exit. ``` Would be great if it can be done through CLI. Thanks again!
2019-01-24T20:36:16
Mailu/Mailu
877
Mailu__Mailu-877
[ "925" ]
626b8a9d05bed54777704124a77ef4a884a4d052
diff --git a/core/admin/mailu/manage.py b/core/admin/mailu/manage.py --- a/core/admin/mailu/manage.py +++ b/core/admin/mailu/manage.py @@ -64,7 +64,7 @@ def admin(localpart, domain_name, password): @click.argument('localpart') @click.argument('domain_name') @click.argument('password') [email protected]('hash_scheme') [email protected]('hash_scheme', required=False) @flask_cli.with_appcontext def user(localpart, domain_name, password, hash_scheme=None): """ Create a user @@ -86,12 +86,14 @@ def user(localpart, domain_name, password, hash_scheme=None): @mailu.command() [email protected]('-n', '--domain_name') [email protected]('-u', '--max_users') [email protected]('-a', '--max_aliases') [email protected]('-q', '--max_quota_bytes') [email protected]('domain_name') [email protected]('-u', '--max-users') [email protected]('-a', '--max-aliases') [email protected]('-q', '--max-quota-bytes') @flask_cli.with_appcontext def domain(domain_name, max_users=-1, max_aliases=-1, max_quota_bytes=0): + """ Create a domain + """ domain = models.Domain.query.get(domain_name) if not domain: domain = models.Domain(name=domain_name) @@ -126,7 +128,7 @@ def user_import(localpart, domain_name, password_hash, hash_scheme = None): @mailu.command() @click.option('-v', '--verbose') [email protected]('-d', '--delete_objects') [email protected]('-d', '--delete-objects') @flask_cli.with_appcontext def config_update(verbose=False, delete_objects=False): """sync configuration with data from YAML-formatted stdin"""
command documentation uses `_` where `-` should be used https://mailu.io/1.6/cli.html shows commands ``` alias alias_delete user user_import user_delete config_update ``` where `flask mailu` shows the following subcommands: ``` Commands: admin Create an admin user advertise Advertise this server against statistic services. alias Create an alias alias-delete delete alias config-update sync configuration with data from YAML-formatted stdin domain setlimits Set domain limits setmanager Make a user manager of a domain user Create a user user-delete delete user user-import Import a user along with password hash. ``` I think the documentation must be updated to use `-` rather than `_`.
2019-01-24T22:01:37
Mailu/Mailu
891
Mailu__Mailu-891
[ "808" ]
da52c64cd849b357be0de9ecec90cb2f3b20f722
diff --git a/services/fetchmail/fetchmail.py b/services/fetchmail/fetchmail.py --- a/services/fetchmail/fetchmail.py +++ b/services/fetchmail/fetchmail.py @@ -22,7 +22,6 @@ is "{user_email}" smtphost "{smtphost}" {options} - sslproto 'AUTO' """ @@ -54,7 +53,7 @@ def run(debug): for fetch in fetches: fetchmailrc = "" options = "options antispam 501, 504, 550, 553, 554" - options += " ssl" if fetch["tls"] else "" + options += " sslmode wrapped" if fetch["tls"] else "" options += " keep" if fetch["keep"] else " fetchall" fetchmailrc += RC_LINE.format( user_email=escape_rc_string(fetch["user_email"]),
Fetchmail sslproto configuration (typo?) The fetchmail container repeatedly fires the following warning `fetchmail: Invalid SSL protocol 'AUTO' specified, using default (SSLv23).` From the fetchmail manpage, this appears to relate to the `--sslproto` switch. IMHO the default should be an all lowercase `auto`. Otherwise, an improvement suggestion would be to make this configurable through the admin interface.
2019-01-27T10:52:20
Mailu/Mailu
929
Mailu__Mailu-929
[ "905", "905" ]
d3a5c7058927698cf66b9105bfb4daa95da33b85
diff --git a/core/admin/migrations/versions/5aeb5811408e_.py b/core/admin/migrations/versions/5aeb5811408e_.py --- a/core/admin/migrations/versions/5aeb5811408e_.py +++ b/core/admin/migrations/versions/5aeb5811408e_.py @@ -106,7 +106,7 @@ def upgrade(): # lower relays for relay in connection.execute(relay_table.select()): connection.execute(relay_table.update().where( - relay_tbale.c.name == relay.name + relay_table.c.name == relay.name ).values( name=relay.name.lower() ))
Typo in migration file Looking at logs I found a typo in one of the migration files. I don't really know if it is possible to change migration files manually so I'm not writing a pull request but a bug report ;) https://github.com/Mailu/Mailu/blob/c484c5326b17877bc66a454970cf1342f956d47e/core/admin/migrations/versions/5aeb5811408e_.py#L109 This should probably read relay_table. Typo in migration file Looking at logs I found a typo in one of the migration files. I don't really know if it is possible to change migration files manually so I'm not writing a pull request but a bug report ;) https://github.com/Mailu/Mailu/blob/c484c5326b17877bc66a454970cf1342f956d47e/core/admin/migrations/versions/5aeb5811408e_.py#L109 This should probably read relay_table.
2019-02-12T16:20:44
Mailu/Mailu
931
Mailu__Mailu-931
[ "716" ]
da52c64cd849b357be0de9ecec90cb2f3b20f722
diff --git a/core/admin/mailu/configuration.py b/core/admin/mailu/configuration.py --- a/core/admin/mailu/configuration.py +++ b/core/admin/mailu/configuration.py @@ -46,6 +46,7 @@ 'WEBSITE': 'https://mailu.io', 'WEB_ADMIN': '/admin', 'WEB_WEBMAIL': '/webmail', + 'WEBMAIL': 'none', 'RECAPTCHA_PUBLIC_KEY': '', 'RECAPTCHA_PRIVATE_KEY': '', # Advanced settings @@ -79,6 +80,8 @@ def resolve_host(self): self.config['HOST_POP3'] = resolve(self.config['HOST_POP3']) self.config['HOST_AUTHSMTP'] = resolve(self.config['HOST_AUTHSMTP']) self.config['HOST_SMTP'] = resolve(self.config['HOST_SMTP']) + if self.config['WEBMAIL'] != 'none': + self.config['HOST_WEBMAIL'] = resolve(self.config['HOST_WEBMAIL']) def __coerce_value(self, value): if isinstance(value, str) and value.lower() in ('true','yes'): diff --git a/core/admin/mailu/internal/__init__.py b/core/admin/mailu/internal/__init__.py --- a/core/admin/mailu/internal/__init__.py +++ b/core/admin/mailu/internal/__init__.py @@ -1,6 +1,7 @@ from flask_limiter import RateLimitExceeded from mailu import utils +from flask import current_app as app import socket import flask @@ -23,7 +24,7 @@ def rate_limit_handler(e): def whitelist_webmail(): try: return flask.request.headers["Client-Ip"] ==\ - socket.gethostbyname("webmail") + app.config["HOST_WEBMAIL"] except: return False
Admin whitelist_webmail hard coded Hi, I'm trying to send transactional email with Mailu SMTP from a backend server and it takes more than 15s. I tracked down one problem in core/admin/mailu/internal/__init__.py: def whitelist_webmail() uses socket.gethostbyname("webmail") In my docker configuration there is no "webmail" host so the function socket.gethostbyname return nothing after 5s which slows down a lot the request /internal/auth/email When I set "webmail" to a fake ip on the admin server the /internal/auth/email returns immediately. Maybe it would be better to define a list of hostnames in the configuration file instead of using a hard coded "webmail" value. What do you think? Thanks Mailu for the great work! JB
https://github.com/Mailu/Mailu/blob/d3a5c7058927698cf66b9105bfb4daa95da33b85/core/admin/mailu/internal/__init__.py#L25-L26 @ionutfilip, so there is still a cheeky `gethostbyname` hidden somewhere. Can you please rewrite this snippet to use the resolved addresses, like you implemented with `mailustart` in PR #886.
2019-02-13T10:12:29
Mailu/Mailu
932
Mailu__Mailu-932
[ "905" ]
ef478de480fe9200590fc31c5debe89988b8c257
diff --git a/core/admin/migrations/versions/5aeb5811408e_.py b/core/admin/migrations/versions/5aeb5811408e_.py --- a/core/admin/migrations/versions/5aeb5811408e_.py +++ b/core/admin/migrations/versions/5aeb5811408e_.py @@ -106,7 +106,7 @@ def upgrade(): # lower relays for relay in connection.execute(relay_table.select()): connection.execute(relay_table.update().where( - relay_tbale.c.name == relay.name + relay_table.c.name == relay.name ).values( name=relay.name.lower() ))
Typo in migration file Looking at logs I found a typo in one of the migration files. I don't really know if it is possible to change migration files manually so I'm not writing a pull request but a bug report ;) https://github.com/Mailu/Mailu/blob/c484c5326b17877bc66a454970cf1342f956d47e/core/admin/migrations/versions/5aeb5811408e_.py#L109 This should probably read relay_table.
2019-02-13T10:42:08
Mailu/Mailu
934
Mailu__Mailu-934
[ "933" ]
626b8a9d05bed54777704124a77ef4a884a4d052
diff --git a/core/admin/mailu/manage.py b/core/admin/mailu/manage.py --- a/core/admin/mailu/manage.py +++ b/core/admin/mailu/manage.py @@ -94,7 +94,8 @@ def user(localpart, domain_name, password, hash_scheme=None): def domain(domain_name, max_users=-1, max_aliases=-1, max_quota_bytes=0): domain = models.Domain.query.get(domain_name) if not domain: - domain = models.Domain(name=domain_name) + domain = models.Domain(name=domain_name, max_users=max_users, + max_aliases=max_aliases, max_quota_bytes=max_quota_bytes) db.session.add(domain) db.session.commit()
CLI domain creation arguments bug When creating a new domain using cli we have optional arguments that can be passed ```bash $ docker-compose exec admin flask mailu domain --help Usage: flask mailu domain [OPTIONS] DOMAIN_NAME Create a domain Options: -u, --max-users TEXT -a, --max-aliases TEXT -q, --max-quota-bytes TEXT --help Show this message and exit. ``` Looks like we are passing only domain name, keeping the rest of variables to default https://github.com/Mailu/Mailu/blob/626b8a9d05bed54777704124a77ef4a884a4d052/core/admin/mailu/manage.py#L97
2019-02-13T14:57:56
Mailu/Mailu
951
Mailu__Mailu-951
[ "924" ]
c2f3966604d74e4a3a1524d8824d7b526821adc2
diff --git a/setup/server.py b/setup/server.py --- a/setup/server.py +++ b/setup/server.py @@ -90,7 +90,10 @@ def submit_flavor(): def submit(): data = flask.request.form.copy() data['uid'] = str(uuid.uuid4()) - data['dns'] = str(ipaddress.IPv4Network(data['subnet'])[-2]) + try: + data['dns'] = str(ipaddress.IPv4Network(data['subnet'])[-2]) + except ValueError as err: + return "Error while generating files: " + str(err) db.set(data['uid'], json.dumps(data)) return flask.redirect(flask.url_for('.setup', uid=data['uid']))
Internal Error with setup Hi, Thanks for the work ! I want to try the new version with setup.mailu.io + Docker stack. However I have already this when I want to generate my compose: > Internal Server Error > The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application. Is it normal?
Stack is experimental-ish. I hope you've seen the warning on setup? >Setup is capable of generating a somewhat decent docker-compose.yml, for the docker stack flavor. However its usage is for advanced users an is experimental. Expect many challenges is shared mail storage and fail-over scenarios! Some user experiences have been shared on GitHub. You kinda have to fiddle with the config to make it work. Or be more specific to us on the error, (like log output). Hi, This is not only an issue with swarm. I got the same error generating a regular docker-compose. ![image](https://user-images.githubusercontent.com/16164175/53271141-462b9380-36cc-11e9-83f2-d47a81690294.png)
2019-02-25T09:53:37
Mailu/Mailu
958
Mailu__Mailu-958
[ "387" ]
829441def5761592e5caeefd32a01aff4d8753c7
diff --git a/core/postfix/start.py b/core/postfix/start.py --- a/core/postfix/start.py +++ b/core/postfix/start.py @@ -48,6 +48,11 @@ def start_podop(): os.system("postmap {}".format(destination)) os.remove(destination) +if "RELAYUSER" in os.environ: + path = "/etc/postfix/sasl_passwd" + convert("/conf/sasl_passwd", path) + os.system("postmap {}".format(path)) + convert("/conf/rsyslog.conf", "/etc/rsyslog.conf") # Run Podop and Postfix
Using external smtp relay server for outgoing emails Hi, I need to use mailchannels.com to relay all outgoing emails from my Mailu install. In this doc is what I need to change in Postfix: https://mailchannels.zendesk.com/hc/en-us/articles/200262640-Setting-up-for-Postfix Is there any way to do this in Mailu ? Thanks,
No, there is not currently, you have to add a couple of lines to postfix configuration. I've just made a script to do that. I can make a PR if it's gonna be welcomed. What do you think @kaiyou? @OrkhanAlikhanov You can share the code of the script ? Thanks, Specify relay variables in .env file: ``` RELAYHOST=[smtp.mailgun.org]:587 RELAY_LOGIN=xxxx RELAY_PASSWORD=xxxx ``` Create **relay_conf.sh** ```bash #!/bin/sh # Configuration for the script POSTFIX_CONFIG=/etc/postfix/main.cf POSTFIX_SASL=/etc/postfix/sasl_passwd # Set a safe umask umask 077 # Add the relay host params cat >> $POSTFIX_CONFIG << EOF # Mailgun configuration smtp_tls_security_level = encrypt smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:$POSTFIX_SASL smtp_sasl_security_options = noanonymous EOF # Remove old rm -f $POSTFIX_SASL # Create new cat > $POSTFIX_SASL << EOF $RELAYHOST $RELAY_LOGIN:$RELAY_PASSWORD EOF chmod 600 $POSTFIX_SASL postmap $POSTFIX_SASL # Reload Postfix /etc/init.d/postfix restart ``` Then make the `relay_conf.sh` executable and copy it to the docker where postfix runs. In my case it was docker named: `mailu_smtp_1`. ``` bash sudo chmod +x relay_conf.sh sudo docker cp ./relay_conf.sh mailu_smtp_1:/relay_conf.sh sudo docker exec -e .env -it mailu_smtp_1 /relay_conf.sh ``` It's done. You may need to adjust some other parameters in the script according to relay server's need. I configured it for MailGun. ***Note:** you need to perform these steps each time you rebuild the dockers The script is modified version of https://gist.github.com/jgeewax/2c63810a534197c8a6be This is pretty nice, @OrkhanAlikhanov :) if you could insert this as optional parameters in the `.env` and use the Jinja template in the Postfix container, it definitely would deserve a merge! @kaiyou Cool. I'll PR this weekend inshaAllah :) Using the @OrkhanAlikhanov solution as a starting point I was able to configure Mailu to send emails using the Mailchannels service (it works for Mailgun and others as well) as follows: 1) Create the **data/overrides/postfix-maichannels.map** file and put the authentication credentials for **smtp.mailchannels.net** in it: ``` smtp.mailchannels.net mailchannelsuser:mailchannelspassword ``` 2) Create/edit the **data/overrides/postfix.cf** file with the settings to be used by Postfix: ``` smtp_sasl_auth_enable = yes smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/postfix-maichannels.map smtpd_sasl_authenticated_header = yes smtp_sasl_security_options = noanonymous smtp_sasl_mechanism_filter = AUTH LOGIN smtp_tls_security_level = encrypt smtp_sasl_tls_security_options = noanonymous ``` 3) Edit the **.env** file and set the **RELAYHOST** variable: ``` RELAYHOST=smtp.mailchannels.net ``` 4) Reload/restart mailu **IMPORTANT**: Note that in the **data/overrides/postfix.cf** file the **smtp_sasl_auth_enable** entry appears 2 times: ``` smtp_sasl_auth_enable = yes smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/postfix-maichannels.map ... ``` This is not a typo. The **postconf** command when setting a variable that does not exist in the original **/etc/postfix/main.cf** adds it to the end of the **/etc/postfix/main.cf** file without a *<newline>* before. That is, as the Mailu **/conf/main.cf** file used to create the original **/etc/postfix/main.cf**ends like this: ``` ############### # Extra Settings ############### ``` The first run of **postconf -e "smtp_sasl_auth_enable = yes"** from **start.py** will make **/etc/postfix/main.cf** look like this: ``` ############### # Extra Settings ###############smtp_sasl_auth_enable = yes ``` And after the second run we get the desired result: ``` ############### # Extra Settings ###############smtp_sasl_auth_enable = yes smtp_sasl_auth_enable = yes ``` Of course this is an ugly and temporary solution. One permanent solution would be to change the **start.py** to something like: ``` for postfix_file in glob.glob("/conf/*.cf"): convert(postfix_file, os.path.join("/etc/postfix", os.path.basename(postfix_file))) with open("/etc/postfix/{0}".format(os.path.basename(postfix_file)), 'a') as f: f.write("\n") ``` To make sure that all Postfix configuration files end with a blank line. @OrkhanAlikhanov Thanks for your script! I made a few changes as I had some errors, one of them being: `sh: /etc/init.d/postfix: not found` (possibly because of the lightweight linux distro inside docker) Aside from the changed script, there's not much else to do, so you can just follow the tutorial mentioned above (https://github.com/Mailu/Mailu/issues/387#issuecomment-370464619) I changed the script to this (note that it's now using overrides and `postfix reload`): ```sh #!/bin/sh # Configuration for the script POSTFIX_CONFIG=/overrides/postfix.cf POSTFIX_SASL=/etc/postfix/sasl_passwd # Set a safe umask umask 077 # Add the relay host params cat >> $POSTFIX_CONFIG << EOF smtp_tls_security_level = encrypt smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:$POSTFIX_SASL smtp_sasl_security_options = noanonymous EOF # Remove old rm -f $POSTFIX_SASL # Create new cat > $POSTFIX_SASL << EOF $RELAYHOST $RELAY_LOGIN:$RELAY_PASSWORD EOF chmod 600 $POSTFIX_SASL postmap $POSTFIX_SASL # Reload Postfix postfix reload ``` **Reasons for these changes:** - Even if you restart (read: not rebuild) Docker, the changes remain working - Errors regarding `/etc/init.d/postfix` Thanks! This helped me. I'm using it with Sendgrid. For specific configs check [here](https://sendgrid.com/docs/for-developers/sending-email/postfix/). (But it seems I have to [remove SPF, DKIM and DMARC](https://sendgrid.com/blog/dmarc-domain-based-message-authentication-reporting-conformance/))
2019-03-04T18:09:53
Mailu/Mailu
993
Mailu__Mailu-993
[ "867" ]
da52c64cd849b357be0de9ecec90cb2f3b20f722
diff --git a/core/admin/mailu/models.py b/core/admin/mailu/models.py --- a/core/admin/mailu/models.py +++ b/core/admin/mailu/models.py @@ -436,20 +436,37 @@ class Alias(Base, Email): @classmethod def resolve(cls, localpart, domain_name): - return cls.query.filter( - sqlalchemy.and_(cls.domain_name == domain_name, - sqlalchemy.or_( - sqlalchemy.and_( - cls.wildcard == False, - cls.localpart == localpart - ), sqlalchemy.and_( - cls.wildcard == True, - sqlalchemy.bindparam("l", localpart).like(cls.localpart) + alias_preserve_case = cls.query.filter( + sqlalchemy.and_(cls.domain_name == domain_name, + sqlalchemy.or_( + sqlalchemy.and_( + cls.wildcard == False, + cls.localpart == localpart + ), sqlalchemy.and_( + cls.wildcard == True, + sqlalchemy.bindparam("l", localpart).like(cls.localpart) + ) ) ) - ) - ).order_by(cls.wildcard, sqlalchemy.func.char_length(cls.localpart).desc()).first() + ).order_by(cls.wildcard, sqlalchemy.func.char_length(cls.localpart).desc()).first() + if alias_preserve_case: + return alias_preserve_case + if localpart: + localpart = localpart.lower() + return cls.query.filter( + sqlalchemy.and_(cls.domain_name == domain_name, + sqlalchemy.or_( + sqlalchemy.and_( + cls.wildcard == False, + sqlalchemy.func.lower(cls.localpart) == localpart + ), sqlalchemy.and_( + cls.wildcard == True, + sqlalchemy.bindparam("l", localpart).like(sqlalchemy.func.lower(cls.localpart)) + ) + ) + ) + ).order_by(cls.wildcard, sqlalchemy.func.char_length(sqlalchemy.func.lower(cls.localpart)).desc()).first() class Token(Base): """ A token is an application password for a given user.
Local-parts are case-sensitive, but aliases cannot be create in a case-sensitive way By RFC5321 2.4, mailbox names / locaparts are to be case-sensitive: > [โ€ฆ] The local-part of a mailbox MUST BE treated as case sensitive. > Therefore, SMTP implementations MUST take care to preserve the case of mailbox local-parts. In particular, for some hosts, the user "smith" is different from the user "Smith". [โ€ฆ] However, aliases cannot be created in a case-sensitive manner. That means when i already have `[email protected]`, i cannot create `[email protected]` as alias. This makes it hard to catch mis-guided mails due to capitalization mistakes on user-end. Also, the `admin` container replies with a stacktrace and `500`, which is not that nice. Hereโ€™s an example: ``` admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.726925967Z [2019-01-23 18:31:18,724] ERROR in app: Exception on /ui/alias/create/domain.com [POST] admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.726948416Z Traceback (most recent call last): admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.726952189Z File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1193, in _execute_context admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.726954791Z context) admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.726957190Z File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 509, in do_execute admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.726959764Z cursor.execute(statement, parameters) admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.726962040Z sqlite3.IntegrityError: UNIQUE constraint failed: alias.email admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.726964832Z admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.726968152Z The above exception was the direct cause of the following exception: admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.726971744Z admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.726974948Z Traceback (most recent call last): admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.726977487Z File "/usr/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.726979843Z response = self.full_dispatch_request() admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.726982141Z File "/usr/lib/python3.6/site-packages/flask/app.py", line 1815, in full_dispatch_request admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.726984964Z rv = self.handle_user_exception(e) admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.726987152Z File "/usr/lib/python3.6/site-packages/flask/app.py", line 1718, in handle_user_exception admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.726989664Z reraise(exc_type, exc_value, tb) admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.726992130Z File "/usr/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.726994455Z raise value admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.726997167Z File "/usr/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.726999625Z rv = self.dispatch_request() admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727001830Z File "/usr/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727011281Z return self.view_functions[rule.endpoint](**req.view_args) admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727013701Z File "/usr/lib/python3.6/site-packages/flask_login/utils.py", line 261, in decorated_view admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727016007Z return func(*args, **kwargs) admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727018140Z File "/app/mailu/ui/access.py", line 28, in wrapper admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727020407Z return callback(function, args, kwargs, dargs, dkwargs) admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727022693Z File "/app/mailu/ui/access.py", line 19, in callback admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727024951Z return function(*args, **kwargs) admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727027105Z File "/app/mailu/ui/views/aliases.py", line 31, in alias_create admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727029399Z models.db.session.commit() admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727031561Z File "/usr/lib/python3.6/site-packages/sqlalchemy/orm/scoping.py", line 153, in do admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727033856Z return getattr(self.registry(), name)(*args, **kwargs) admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727036052Z File "/usr/lib/python3.6/site-packages/sqlalchemy/orm/session.py", line 943, in commit admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727038401Z self.transaction.commit() admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727041396Z File "/usr/lib/python3.6/site-packages/sqlalchemy/orm/session.py", line 467, in commit admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727043774Z self._prepare_impl() admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727046016Z File "/usr/lib/python3.6/site-packages/sqlalchemy/orm/session.py", line 447, in _prepare_impl admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727048326Z self.session.flush() admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727050503Z File "/usr/lib/python3.6/site-packages/sqlalchemy/orm/session.py", line 2254, in flush admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727052793Z self._flush(objects) admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727054975Z File "/usr/lib/python3.6/site-packages/sqlalchemy/orm/session.py", line 2381, in _flush admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727057335Z transaction.rollback(_capture_exception=True) admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727059515Z File "/usr/lib/python3.6/site-packages/sqlalchemy/util/langhelpers.py", line 66, in __exit__ admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727061791Z compat.reraise(exc_type, exc_value, exc_tb) admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727064072Z File "/usr/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 249, in reraise admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727066363Z raise value admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727068593Z File "/usr/lib/python3.6/site-packages/sqlalchemy/orm/session.py", line 2345, in _flush admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727070874Z flush_context.execute() admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727073023Z File "/usr/lib/python3.6/site-packages/sqlalchemy/orm/unitofwork.py", line 395, in execute admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727075305Z rec.execute(self) admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727077482Z File "/usr/lib/python3.6/site-packages/sqlalchemy/orm/unitofwork.py", line 560, in execute admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727079759Z uow admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727083889Z File "/usr/lib/python3.6/site-packages/sqlalchemy/orm/persistence.py", line 181, in save_obj admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727087126Z mapper, table, insert) admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727090230Z File "/usr/lib/python3.6/site-packages/sqlalchemy/orm/persistence.py", line 866, in _emit_insert_statements admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727094133Z execute(statement, params) admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727096369Z File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 948, in execute admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727098656Z return meth(self, multiparams, params) admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727100835Z File "/usr/lib/python3.6/site-packages/sqlalchemy/sql/elements.py", line 269, in _execute_on_connection admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727103151Z return connection._execute_clauseelement(self, multiparams, params) admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727105502Z File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1060, in _execute_clauseelement admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727107808Z compiled_sql, distilled_params admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727109958Z File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1200, in _execute_context admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727112269Z context) admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727114480Z File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1413, in _handle_dbapi_exception admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727116827Z exc_info admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727119509Z File "/usr/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 265, in raise_from_cause admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727122920Z reraise(type(exception), exception, tb=exc_tb, cause=cause) admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727126337Z File "/usr/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 248, in reraise admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727129653Z raise value.with_traceback(tb) admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727132813Z File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1193, in _execute_context admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727135975Z context) admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727139066Z File "/usr/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 509, in do_execute admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727142593Z cursor.execute(statement, parameters) admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727146001Z sqlalchemy.exc.IntegrityError: (sqlite3.IntegrityError) UNIQUE constraint failed: alias.email [SQL: 'INSERT INTO alias (created_at, updated_at, comment, localpart, wildcard, destination, domain_name, email) VALUES (?, ?, ?, ?, ?, ?, ?, ?)'] [parameters: ('2019-01-23', None, '', 'J.doe', 0, '[email protected]', 'domain.com', '[email protected]')] (Background on this error at: http://sqlalche.me/e/gkpj) admin_1_cfce06e98ae0 | 2019-01-23T18:31:18.727684900Z 172.31.0.12 - - [23/Jan/2019:18:31:18 +0000] "POST /ui/alias/create/domain.com HTTP/1.0" 500 291 "https://mail.domain.com/admin/ui/alias/create/domain.com" "Mozilla/5.0 (X11; Linux x86_64; rv:64.0) Gecko/20100101 Firefox/64.0" ```
With the update to 1.6 I also have problems with the aliases. Sending to a normal user works case insensitive via your own domain and external mail servers. For example: [email protected] and [email protected] reaches the one user, where [email protected] is the account created. Sending to an alias is case sensitive. The created alias [email protected] always works. Whereas the address [email protected] returns a "User doesn't exist" when sending the email via the internal server. If the email comes via an external server, then somewhere along the way the address is converted to lower case or something else happens, in any case the email arrives at the alias in both spellings. Further it is not possible to create both aliases, this results in an Internal Server Error 500. For our users it is very common to write email addresses with capital letters, whereas the administrators always write the addresses in lower case.
2019-04-14T12:04:00
Mailu/Mailu
1,014
Mailu__Mailu-1014
[ "978", "978" ]
3e626b85001a648f1af8df5afa3e314a93d33482
diff --git a/core/dovecot/start.py b/core/dovecot/start.py --- a/core/dovecot/start.py +++ b/core/dovecot/start.py @@ -24,6 +24,7 @@ def start_podop(): os.environ["FRONT_ADDRESS"] = system.resolve_address(os.environ.get("HOST_FRONT", "front")) os.environ["REDIS_ADDRESS"] = system.resolve_address(os.environ.get("HOST_REDIS", "redis")) os.environ["ADMIN_ADDRESS"] = system.resolve_address(os.environ.get("HOST_ADMIN", "admin")) +os.environ["ANTISPAM_ADDRESS"] = system.resolve_address(os.environ.get("HOST_ANTISPAM", "antispam:11334")) if os.environ["WEBMAIL"] != "none": os.environ["WEBMAIL_ADDRESS"] = system.resolve_address(os.environ.get("HOST_WEBMAIL", "webmail")) diff --git a/services/rspamd/start.py b/services/rspamd/start.py --- a/services/rspamd/start.py +++ b/services/rspamd/start.py @@ -9,11 +9,14 @@ log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", "WARNING")) # Actual startup script + os.environ["FRONT_ADDRESS"] = system.resolve_address(os.environ.get("HOST_FRONT", "front")) if "HOST_REDIS" not in os.environ: os.environ["REDIS_ADDRESS"] = system.resolve_address(os.environ.get("HOST_REDIS", "redis")) +if os.environ.get("ANTIVIRUS") == 'clamav': + os.environ["ANTIVIRUS_ADDRESS"] = system.resolve_address(os.environ.get("HOST_ANTIVIRUS", "antivirus:3310")) for rspamd_file in glob.glob("/conf/*"): conf.jinja(rspamd_file, os.environ, os.path.join("/etc/rspamd/local.d", os.path.basename(rspamd_file)))
Should `antispam` be hardcoded? I'm in a middle of setting up my own mailu instances, however I'm using namespaced container names (i.e. `mailu-admin`, `mailu-front` etc.). Everything works pretty well so far, however I have some problems with imap and antispam. After some investigation I noticed, that files `core/dovecot/conf/bin/ham` and `core/dovecot/conf/bin/spam` have antispam host hardcoded instead of using `HOST_ANTISPAM`. I'm happy to provide PR, but firstly want to be sure - is it in fact oversight, or is this by design? Should `antispam` be hardcoded? I'm in a middle of setting up my own mailu instances, however I'm using namespaced container names (i.e. `mailu-admin`, `mailu-front` etc.). Everything works pretty well so far, however I have some problems with imap and antispam. After some investigation I noticed, that files `core/dovecot/conf/bin/ham` and `core/dovecot/conf/bin/spam` have antispam host hardcoded instead of using `HOST_ANTISPAM`. I'm happy to provide PR, but firstly want to be sure - is it in fact oversight, or is this by design?
Nope, it should not be hardcoded, any PR on the matter is more than welcome :) Nope, it should not be hardcoded, any PR on the matter is more than welcome :)
2019-05-07T09:47:51
Mailu/Mailu
1,052
Mailu__Mailu-1052
[ "1051" ]
f77e1bdd0ea1868caa52c071793bc7aeec69618c
diff --git a/core/postfix/start.py b/core/postfix/start.py --- a/core/postfix/start.py +++ b/core/postfix/start.py @@ -53,12 +53,7 @@ def start_podop(): convert("/conf/sasl_passwd", path) os.system("postmap {}".format(path)) -convert("/conf/rsyslog.conf", "/etc/rsyslog.conf") - # Run Podop and Postfix multiprocessing.Process(target=start_podop).start() -if os.path.exists("/var/run/rsyslogd.pid"): - os.remove("/var/run/rsyslogd.pid") -os.system("/usr/lib/postfix/post-install meta_directory=/etc/postfix create-missing") -os.system("/usr/lib/postfix/master &") -os.execv("/usr/sbin/rsyslogd", ["rsyslogd", "-n"]) +os.system("/usr/libexec/postfix/post-install meta_directory=/etc/postfix create-missing") +os.system("postfix start-fg")
Regular alpine base-image update To receive current updates for upstream projects, security fixes and new features such as mentioned in #1049 , letโ€™s upgrade the alpine baseimage to latest 3.10
2019-06-23T19:31:39
Mailu/Mailu
1,067
Mailu__Mailu-1067
[ "1066" ]
ba22fb0007a2031f2d5cdaba4b70f6c02a0b70b2
diff --git a/core/admin/mailu/manage.py b/core/admin/mailu/manage.py --- a/core/admin/mailu/manage.py +++ b/core/admin/mailu/manage.py @@ -85,6 +85,26 @@ def user(localpart, domain_name, password, hash_scheme=None): db.session.commit() [email protected]() [email protected]('localpart') [email protected]('domain_name') [email protected]('password') [email protected]('hash_scheme', required=False) +@flask_cli.with_appcontext +def password(localpart, domain_name, password, hash_scheme=None): + """ Change the password of an user + """ + email = '{0}@{1}'.format(localpart, domain_name) + user = models.User.query.get(email) + if hash_scheme is None: + hash_scheme = app.config['PASSWORD_SCHEME'] + if user: + user.set_password(password, hash_scheme=hash_scheme) + else: + print("User " + email + " not found.") + db.session.commit() + + @mailu.command() @click.argument('domain_name') @click.option('-u', '--max-users')
Update user password in commandline A feature request, the ability to set/reset a user's password from the Mailu command line. Similar to the [user](https://mailu.io/master/cli.html#user) command: ``` docker-compose exec admin flask mailu password myuser example.net 'password123' ``` My particular interest is for the Demo server, some people find it necessary to change the admin password from time to time. Executing a full reset takes over a minute, in which period the Demo is not available. I don't want to execute it more frequent than daily. It would be nice to can just call above command every few minutes and always override the admin's password with the correct one. See also #987.
2019-07-08T08:50:17
Mailu/Mailu
1,084
Mailu__Mailu-1084
[ "1083" ]
2788909a134217f2e5516fff938df55b644c258c
diff --git a/setup/server.py b/setup/server.py --- a/setup/server.py +++ b/setup/server.py @@ -91,7 +91,7 @@ def submit(): data = flask.request.form.copy() data['uid'] = str(uuid.uuid4()) try: - data['dns'] = str(ipaddress.IPv4Network(data['subnet'])[-2]) + data['dns'] = str(ipaddress.IPv4Network(data['subnet'], strict=False)[-2]) except ValueError as err: return "Error while generating files: " + str(err) db.set(data['uid'], json.dumps(data))
Setup error for incorrect docker network subnet When entering an incorrect docker subnet (e.g. 172.168.0.1/16) the setup throws a 500 error -- without any reasons being given. If you run locally, the error is clearly reported in an ungraceful way.
2019-07-25T10:06:02
Mailu/Mailu
1,088
Mailu__Mailu-1088
[ "1087" ]
cb13689ef5fa40d44726a672bfe6e7933d2cd8b5
diff --git a/core/admin/mailu/internal/views/postfix.py b/core/admin/mailu/internal/views/postfix.py --- a/core/admin/mailu/internal/views/postfix.py +++ b/core/admin/mailu/internal/views/postfix.py @@ -2,10 +2,13 @@ from mailu.internal import internal import flask +import re @internal.route("/postfix/domain/<domain_name>") def postfix_mailbox_domain(domain_name): + if re.match("^\[.*\]$", domain_name): + return flask.abort(404) domain = models.Domain.query.get(domain_name) or \ models.Alternative.query.get(domain_name) or \ flask.abort(404) @@ -29,7 +32,7 @@ def postfix_alias_map(alias): @internal.route("/postfix/transport/<path:email>") def postfix_transport(email): - if email == '*': + if email == '*' or re.match("(^|.*@)\[.*\]$", email): return flask.abort(404) localpart, domain_name = models.Email.resolve_domain(email) relay = models.Relay.query.get(domain_name) or flask.abort(404)
MAIL FROM: does-not-exist@[X.X.X.X] results in an admin exeption stacktrace If a client (read: malicious attacker) connects to Postfix and uses an IP address within brackets instead of a domain name for the sender, e.g.: ``` $ telnet mail.example.com 25 Connected to example.com Escape character is '^]'. 220 mail.example.com ESMTP ready EHLO dummy.example.com 250-mail.example.com 250 STARTTLS MAIL FROM: does-not-exist@[116.203.165.200] 250 2.0.0 OK RCPT TO: [email protected] 451 4.3.0 <does-not-exist@[116.203.165.200]>: Temporary lookup failure ``` we see the following stracktrace in the admin container: ``` [2019-07-27 14:26:27,015] ERROR in app: Exception on /internal/postfix/domain/[116.203.165.200] [GET] Traceback (most recent call last): File "/usr/lib/python3.7/site-packages/idna/core.py", line 271, in alabel ulabel(label) File "/usr/lib/python3.7/site-packages/idna/core.py", line 307, in ulabel check_label(label) File "/usr/lib/python3.7/site-packages/idna/core.py", line 261, in check_label raise InvalidCodepoint('Codepoint {0} at position {1} of {2} not allowed'.format(_unot(cp_value), pos+1, repr(label))) idna.core.InvalidCodepoint: Codepoint U+005B at position 1 of '[116' not allowed During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1127, in _execute_context context = constructor(dialect, self, conn, *args) File "/usr/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 669, in _init_compiled param.append(processors[key](compiled_params[key])) File "/usr/lib/python3.7/site-packages/sqlalchemy/sql/type_api.py", line 1182, in process return process_param(value, dialect) File "/app/mailu/models.py", line 30, in process_bind_param return idna.encode(value).decode("ascii").lower() File "/usr/lib/python3.7/site-packages/idna/core.py", line 361, in encode s = alabel(label) File "/usr/lib/python3.7/site-packages/idna/core.py", line 273, in alabel raise IDNAError('The label {0} is not a valid A-label'.format(label)) idna.core.IDNAError: The label b'[116' is not a valid A-label The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/lib/python3.7/site-packages/flask/app.py", line 2292, in wsgi_app response = self.full_dispatch_request() File "/usr/lib/python3.7/site-packages/flask/app.py", line 1815, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/lib/python3.7/site-packages/flask/app.py", line 1718, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/lib/python3.7/site-packages/flask/_compat.py", line 35, in reraise raise value File "/usr/lib/python3.7/site-packages/flask/app.py", line 1813, in full_dispatch_request rv = self.dispatch_request() File "/usr/lib/python3.7/site-packages/flask/app.py", line 1799, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/app/mailu/internal/views/postfix.py", line 9, in postfix_mailbox_domain domain = models.Domain.query.get(domain_name) or \ File "/usr/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 924, in get ident, loading.load_on_pk_identity) File "/usr/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 1007, in _get_impl return db_load_fn(self, primary_key_identity) File "/usr/lib/python3.7/site-packages/sqlalchemy/orm/loading.py", line 250, in load_on_pk_identity return q.one() File "/usr/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 2954, in one ret = self.one_or_none() File "/usr/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 2924, in one_or_none ret = list(self) File "/usr/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 2995, in __iter__ return self._execute_and_instances(context) File "/usr/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3018, in _execute_and_instances result = conn.execute(querycontext.statement, self._params) File "/usr/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 948, in execute return meth(self, multiparams, params) File "/usr/lib/python3.7/site-packages/sqlalchemy/sql/elements.py", line 269, in _execute_on_connection return connection._execute_clauseelement(self, multiparams, params) File "/usr/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1060, in _execute_clauseelement compiled_sql, distilled_params File "/usr/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1132, in _execute_context None, None) File "/usr/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1413, in _handle_dbapi_exception exc_info File "/usr/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 265, in raise_from_cause reraise(type(exception), exception, tb=exc_tb, cause=cause) File "/usr/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 248, in reraise raise value.with_traceback(tb) File "/usr/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1127, in _execute_context context = constructor(dialect, self, conn, *args) File "/usr/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 669, in _init_compiled param.append(processors[key](compiled_params[key])) File "/usr/lib/python3.7/site-packages/sqlalchemy/sql/type_api.py", line 1182, in process return process_param(value, dialect) File "/app/mailu/models.py", line 30, in process_bind_param return idna.encode(value).decode("ascii").lower() File "/usr/lib/python3.7/site-packages/idna/core.py", line 361, in encode s = alabel(label) File "/usr/lib/python3.7/site-packages/idna/core.py", line 273, in alabel raise IDNAError('The label {0} is not a valid A-label'.format(label)) sqlalchemy.exc.StatementError: (idna.core.IDNAError) The label b'[116' is not a valid A-label [SQL: 'SELECT domain.created_at AS domain_created_at, domain.updated_at AS domain_updated_at, domain.comment AS domain_comment, domain.name AS domain_name, domain.max_users AS domain_max_users, domain.max_aliases AS domain_max_aliases, domain.max_quota_bytes AS domain_max_quota_bytes, domain.signup_enabled AS domain_signup_enabled \nFROM domain \nWHERE domain.name = ?'] [parameters: [{'%(140312238936248 param)s': '[116.203.165.200]'}]] 10.36.0.0 - - [27/Jul/2019:14:26:27 +0000] "GET /internal/postfix/domain/%5B116.203.165.200%5D HTTP/1.1" 500 291 "-" "Python/3.7 aiohttp/3.5.4" 10.44.0.0 - - [27/Jul/2019:14:26:31 +0000] "GET /internal/auth/email HTTP/1.0" 200 0 "-" "-" ``` NOTE: the lookup is cached I think and you need to use another IP address to reproduce the error multiple times. I think we're missing some validation rules, because trying a similar (invalid) MAIL FROM with an IP (but without brackets) is handled properly: ``` telnet mail.example.com 25 Trying ... Connected to example.com. Escape character is '^]'. 220 mail.example.com ESMTP ready EHLO dummy.example.com 250-mail.example.com 250 STARTTLS MAIL FROM: [email protected] 250 2.0.0 OK RCPT TO: [email protected] 501 5.1.7 Bad sender address syntax Connection closed by foreign host. ```
Additionally (and what makes it rather irritating and confusing is) we see in the SMTP container the following stracktrace: ``` Jul 27 14:41:00 mail postfix/smtpd[19453]: connect from unknown[10.32.0.1] ERROR:root:Error when processing request Traceback (most recent call last): File "/usr/lib/python3.7/site-packages/podop/postfix.py", line 104, in process_request result = await table.get(key) File "/usr/lib/python3.7/site-packages/podop/table.py", line 35, in get raise Exception(request.status) Exception: 500 Jul 27 14:41:00 mail postfix/trivial-rewrite[19460]: warning: socketmap:unix:/tmp/podop.socket:domain socketmap server temporary error: unknown error Jul 27 14:41:00 mail postfix/trivial-rewrite[19460]: warning: virtual_mailbox_domains: socketmap:unix:/tmp/podop.socket:domain: table lookup problem Jul 27 14:41:00 mail postfix/trivial-rewrite[19460]: warning: virtual_mailbox_domains lookup failure ERROR:root:Error when processing request Traceback (most recent call last): File "/usr/lib/python3.7/site-packages/podop/postfix.py", line 104, in process_request result = await table.get(key) File "/usr/lib/python3.7/site-packages/podop/table.py", line 35, in get raise Exception(request.status) Exception: 500 Jul 27 14:41:00 mail postfix/trivial-rewrite[19460]: warning: socketmap:unix:/tmp/podop.socket:domain socketmap server temporary error: unknown error Jul 27 14:41:00 mail postfix/trivial-rewrite[19460]: warning: virtual_mailbox_domains: socketmap:unix:/tmp/podop.socket:domain: table lookup problem Jul 27 14:41:00 mail postfix/trivial-rewrite[19460]: warning: virtual_mailbox_domains lookup failure Jul 27 14:41:00 mail postfix/smtpd[19453]: NOQUEUE: reject: RCPT from unknown[X.X.X.X]: 451 4.3.0 <does-not-exist@[116.203.165.200]>: Temporary lookup failure; from=<does-not-exist@[116.203.165.200]> to=<[email protected]> proto=ESMTP helo=<dummy.example.com> Jul 27 14:43:11 mail postfix/smtpd[19464]: connect from unknown[10.32.0.1] ```
2019-07-28T06:36:56
Mailu/Mailu
1,130
Mailu__Mailu-1130
[ "1126" ]
f3f0c3190be9ab9b53a29c5b0326fc9a4602df46
diff --git a/core/nginx/config.py b/core/nginx/config.py --- a/core/nginx/config.py +++ b/core/nginx/config.py @@ -16,12 +16,10 @@ args["ADMIN_ADDRESS"] = system.resolve_address(args.get("HOST_ADMIN", "admin")) args["ANTISPAM_ADDRESS"] = system.resolve_address(args.get("HOST_ANTISPAM", "antispam:11334")) -args["HOST_WEBMAIL"] = args.get("HOST_WEBMAIL", "webmail") if args["WEBMAIL"] != "none": - args["WEBMAIL_ADDRESS"] = system.resolve_address(args.get("HOST_WEBMAIL")) -args["HOST_WEBDAV"] = args.get("HOST_WEBDAV", "webdav:5232") + args["WEBMAIL_ADDRESS"] = system.resolve_address(args.get("HOST_WEBMAIL", "webmail")) if args["WEBDAV"] != "none": - args["WEBDAV_ADDRESS"] = system.resolve_address(args.get("HOST_WEBDAV")) + args["WEBDAV_ADDRESS"] = system.resolve_address(args.get("HOST_WEBDAV", "webdav:5232")) # TLS configuration cert_name = os.getenv("TLS_CERT_FILENAME", default="cert.pem")
Unnecessary assignment on `HOST_WEBMAIL` We came across another piece of garbage: https://github.com/Mailu/Mailu/blob/f3f0c3190be9ab9b53a29c5b0326fc9a4602df46/core/nginx/config.py#L19 https://github.com/Mailu/Mailu/blob/f3f0c3190be9ab9b53a29c5b0326fc9a4602df46/core/nginx/config.py#L22
2019-08-22T20:50:06
Mailu/Mailu
1,134
Mailu__Mailu-1134
[ "1125" ]
f3f0c3190be9ab9b53a29c5b0326fc9a4602df46
diff --git a/core/admin/mailu/configuration.py b/core/admin/mailu/configuration.py --- a/core/admin/mailu/configuration.py +++ b/core/admin/mailu/configuration.py @@ -8,8 +8,8 @@ 'BABEL_DEFAULT_LOCALE': 'en', 'BABEL_DEFAULT_TIMEZONE': 'UTC', 'BOOTSTRAP_SERVE_LOCAL': True, - 'RATELIMIT_STORAGE_URL': 'redis://%s/2' % (os.getenv("REDIS_ADDRESS", "redis")), - 'QUOTA_STORAGE_URL': 'redis://%s/1' % (os.getenv("REDIS_ADDRESS", "redis")), + 'RATELIMIT_STORAGE_URL': '', + 'QUOTA_STORAGE_URL': '', 'DEBUG': False, 'DOMAIN_REGISTRATION': False, 'TEMPLATES_AUTO_RELOAD': True,
Redis address parsing is done in init_app This was added in #1107: https://github.com/Mailu/Mailu/blob/f3f0c3190be9ab9b53a29c5b0326fc9a4602df46/core/admin/mailu/configuration.py#L11-L12 While, `REDIS_ADDRESS` is now only resolved in `init_app`. (#940). We took care of that in: https://github.com/Mailu/Mailu/blob/f3f0c3190be9ab9b53a29c5b0326fc9a4602df46/core/admin/mailu/configuration.py#L116-L117 I believe DEFAULT_CONFIG should be like: https://github.com/Mailu/Mailu/blob/4c25c83419be128fb12591721627a718ec23f69d/core/admin/mailu/configuration.py#L12-L13 We are now in the process of backporting #940 to 1.7. PR #1107 was not backported. Therefore 1.7 will look like the last snippet. CC @mildred, @kaiyou
I rebranched, so I'll provide a quick PR to fix this.
2019-08-22T22:30:21
Mailu/Mailu
1,135
Mailu__Mailu-1135
[ "1125" ]
f3f0c3190be9ab9b53a29c5b0326fc9a4602df46
diff --git a/core/admin/mailu/configuration.py b/core/admin/mailu/configuration.py --- a/core/admin/mailu/configuration.py +++ b/core/admin/mailu/configuration.py @@ -8,8 +8,8 @@ 'BABEL_DEFAULT_LOCALE': 'en', 'BABEL_DEFAULT_TIMEZONE': 'UTC', 'BOOTSTRAP_SERVE_LOCAL': True, - 'RATELIMIT_STORAGE_URL': 'redis://%s/2' % (os.getenv("REDIS_ADDRESS", "redis")), - 'QUOTA_STORAGE_URL': 'redis://%s/1' % (os.getenv("REDIS_ADDRESS", "redis")), + 'RATELIMIT_STORAGE_URL': '', + 'QUOTA_STORAGE_URL': '', 'DEBUG': False, 'DOMAIN_REGISTRATION': False, 'TEMPLATES_AUTO_RELOAD': True,
Redis address parsing is done in init_app This was added in #1107: https://github.com/Mailu/Mailu/blob/f3f0c3190be9ab9b53a29c5b0326fc9a4602df46/core/admin/mailu/configuration.py#L11-L12 While, `REDIS_ADDRESS` is now only resolved in `init_app`. (#940). We took care of that in: https://github.com/Mailu/Mailu/blob/f3f0c3190be9ab9b53a29c5b0326fc9a4602df46/core/admin/mailu/configuration.py#L116-L117 I believe DEFAULT_CONFIG should be like: https://github.com/Mailu/Mailu/blob/4c25c83419be128fb12591721627a718ec23f69d/core/admin/mailu/configuration.py#L12-L13 We are now in the process of backporting #940 to 1.7. PR #1107 was not backported. Therefore 1.7 will look like the last snippet. CC @mildred, @kaiyou
I rebranched, so I'll provide a quick PR to fix this.
2019-08-23T06:47:38
Mailu/Mailu
1,183
Mailu__Mailu-1183
[ "1177" ]
e46153c0b1111303875e00ae9cffaa26d5111db5
diff --git a/core/dovecot/start.py b/core/dovecot/start.py --- a/core/dovecot/start.py +++ b/core/dovecot/start.py @@ -32,6 +32,12 @@ def start_podop(): for dovecot_file in glob.glob("/conf/*.conf"): conf.jinja(dovecot_file, os.environ, os.path.join("/etc/dovecot", os.path.basename(dovecot_file))) +os.makedirs("/conf/bin", exist_ok=True) +for script_file in glob.glob("/conf/*.script"): + out_file = os.path.join("/conf/bin/", os.path.basename(script_file).replace('.script','')) + conf.jinja(script_file, os.environ, out_file) + os.chmod(out_file, 0o555) + # Run Podop, then postfix multiprocessing.Process(target=start_podop).start() os.system("chown mail:mail /mail")
Mailu 1.7 : Issue when moving mail to the Junk folder When I move a mail to the Junk Folder, i see the following in the logs: imap_1 | Sep 22 16:51:26 imap: Error: cannot stat file mailu imap_1 | Sep 22 16:51:26 imap: Error: cannot stat file mailu imap_1 | Sep 22 16:51:26 imap: Error: tee: /dev/fd/63: I/O error imap_1 | Sep 22 16:51:26 imap([email protected])<27629><hn93GCeTsresEgAC>: Info: program exec:/conf/bin/spam (27655): Terminated with non-zero exit code 1 imap_1 | Sep 22 16:51:26 imap([email protected])<27629><hn93GCeTsresEgAC>: Info: sieve: left message in mailbox 'Junk'
This is very probably a regression introduced when refactoring the Dovecot container and the way sieve scripts are served. This does not seem so obvious after all. Could you tell us more about your setup, are you using the `_ADDRESS ` variables maybe? I have migrated from 1.6, using the web config generator to help me migrate my docker-compose.yml (no swarm, nor kubernetes). The main difference is that I am not using "Resolver" in all container, only in "rspamd" one. - /mailu is a NFS share.... - docker version is 18.06.3-ce I also have this since upgrading: ``` imap_1_b27192e2a475 | Sep 23 17:55:28 imap-login: Info: Login: user=<[email protected]>, method=PLAIN, rip=172.31.0.4, lip=172.31.0.11, mpid=856, session=<FgoNIDyTCLesHwAE> imap_1_b27192e2a475 | Sep 23 17:55:28 imap([email protected])<856><FgoNIDyTCLesHwAE>: Info: sieve: left message in mailbox 'Junk' imap_1_b27192e2a475 | Sep 23 17:55:28 imap: Error: cannot stat file mailu imap_1_b27192e2a475 | Sep 23 17:55:28 master: Error: waitpid() returned unknown PID 859 imap_1_b27192e2a475 | Sep 23 17:55:28 imap: Error: cannot stat file mailu imap_1_b27192e2a475 | Sep 23 17:55:28 imap([email protected])<856><FgoNIDyTCLesHwAE>: Info: Logged out in=266 out=1729 deleted=1 expunged=1 trashed=0 hdr_count=0 hdr_bytes=0 body_count=0 body_bytes=0 imap_1_b27192e2a475 | Sep 23 17:55:28 master: Error: waitpid() returned unknown PID 860 ``` If I can find some time in the following days, Iโ€™ll try to find the cause too โ€ฆ Possibly a change in the rspamc utility, notably a change in the `-P` flag? Hi, good news: The cause is found, and simple: The `ham` and `spam` scripts in `/conf/bin` of the dovecot container donโ€™t get the `ANTISPAM_ADDRESS` environment anymore. In `start.py`, the address is correctly discovered, and also written to `os.environ`. From the python docs: > If the platform supports the putenv() function, this mapping may be used to modify the environment as well as query the environment. putenv() will be called automatically when the mapping is modified. Iโ€™m a bit puzzled why this suddenly stopped working, and debugging is a bit ugly because i canโ€™t `cat /proc/?/environ` โ€” well, i can, but only garbled binary shit comes out. That was new to me โ€ฆ Now the question is: Should we also use jinja2 to safely inject the address into these scripts, without relying on the environment getting passed? Thatโ€™s a bit ugly, but maybe safer / less fiddly moving forward โ€ฆ โ€ฆ or we try to understand why the environ doesnโ€™t get passed anymore (maybe a dovecot change, stripping environ when calling sieve-child-scripts? or something?) โ€ฆ and see if we can work around it in another way โ€ฆ
2019-09-27T19:56:35
Mailu/Mailu
1,184
Mailu__Mailu-1184
[ "1177" ]
2ce842daeb3a768d6157592262e784c9c2a8aa44
diff --git a/core/dovecot/start.py b/core/dovecot/start.py --- a/core/dovecot/start.py +++ b/core/dovecot/start.py @@ -31,6 +31,12 @@ def start_podop(): for dovecot_file in glob.glob("/conf/*.conf"): conf.jinja(dovecot_file, os.environ, os.path.join("/etc/dovecot", os.path.basename(dovecot_file))) +os.makedirs("/conf/bin", exist_ok=True) +for script_file in glob.glob("/conf/*.script"): + out_file = os.path.join("/conf/bin/", os.path.basename(script_file).replace('.script','')) + conf.jinja(script_file, os.environ, out_file) + os.chmod(out_file, 0o555) + # Run Podop, then postfix multiprocessing.Process(target=start_podop).start() os.system("chown mail:mail /mail")
Mailu 1.7 : Issue when moving mail to the Junk folder When I move a mail to the Junk Folder, i see the following in the logs: imap_1 | Sep 22 16:51:26 imap: Error: cannot stat file mailu imap_1 | Sep 22 16:51:26 imap: Error: cannot stat file mailu imap_1 | Sep 22 16:51:26 imap: Error: tee: /dev/fd/63: I/O error imap_1 | Sep 22 16:51:26 imap([email protected])<27629><hn93GCeTsresEgAC>: Info: program exec:/conf/bin/spam (27655): Terminated with non-zero exit code 1 imap_1 | Sep 22 16:51:26 imap([email protected])<27629><hn93GCeTsresEgAC>: Info: sieve: left message in mailbox 'Junk'
This is very probably a regression introduced when refactoring the Dovecot container and the way sieve scripts are served. This does not seem so obvious after all. Could you tell us more about your setup, are you using the `_ADDRESS ` variables maybe? I have migrated from 1.6, using the web config generator to help me migrate my docker-compose.yml (no swarm, nor kubernetes). The main difference is that I am not using "Resolver" in all container, only in "rspamd" one. - /mailu is a NFS share.... - docker version is 18.06.3-ce I also have this since upgrading: ``` imap_1_b27192e2a475 | Sep 23 17:55:28 imap-login: Info: Login: user=<[email protected]>, method=PLAIN, rip=172.31.0.4, lip=172.31.0.11, mpid=856, session=<FgoNIDyTCLesHwAE> imap_1_b27192e2a475 | Sep 23 17:55:28 imap([email protected])<856><FgoNIDyTCLesHwAE>: Info: sieve: left message in mailbox 'Junk' imap_1_b27192e2a475 | Sep 23 17:55:28 imap: Error: cannot stat file mailu imap_1_b27192e2a475 | Sep 23 17:55:28 master: Error: waitpid() returned unknown PID 859 imap_1_b27192e2a475 | Sep 23 17:55:28 imap: Error: cannot stat file mailu imap_1_b27192e2a475 | Sep 23 17:55:28 imap([email protected])<856><FgoNIDyTCLesHwAE>: Info: Logged out in=266 out=1729 deleted=1 expunged=1 trashed=0 hdr_count=0 hdr_bytes=0 body_count=0 body_bytes=0 imap_1_b27192e2a475 | Sep 23 17:55:28 master: Error: waitpid() returned unknown PID 860 ``` If I can find some time in the following days, Iโ€™ll try to find the cause too โ€ฆ Possibly a change in the rspamc utility, notably a change in the `-P` flag? Hi, good news: The cause is found, and simple: The `ham` and `spam` scripts in `/conf/bin` of the dovecot container donโ€™t get the `ANTISPAM_ADDRESS` environment anymore. In `start.py`, the address is correctly discovered, and also written to `os.environ`. From the python docs: > If the platform supports the putenv() function, this mapping may be used to modify the environment as well as query the environment. putenv() will be called automatically when the mapping is modified. Iโ€™m a bit puzzled why this suddenly stopped working, and debugging is a bit ugly because i canโ€™t `cat /proc/?/environ` โ€” well, i can, but only garbled binary shit comes out. That was new to me โ€ฆ Now the question is: Should we also use jinja2 to safely inject the address into these scripts, without relying on the environment getting passed? Thatโ€™s a bit ugly, but maybe safer / less fiddly moving forward โ€ฆ โ€ฆ or we try to understand why the environ doesnโ€™t get passed anymore (maybe a dovecot change, stripping environ when calling sieve-child-scripts? or something?) โ€ฆ and see if we can work around it in another way โ€ฆ
2019-09-27T19:59:14
Mailu/Mailu
1,196
Mailu__Mailu-1196
[ "1194" ]
20e00ac0c40a27482814b4b1e49d93d414448782
diff --git a/core/admin/mailu/configuration.py b/core/admin/mailu/configuration.py --- a/core/admin/mailu/configuration.py +++ b/core/admin/mailu/configuration.py @@ -51,7 +51,7 @@ 'RECAPTCHA_PUBLIC_KEY': '', 'RECAPTCHA_PRIVATE_KEY': '', # Advanced settings - 'PASSWORD_SCHEME': 'BLF-CRYPT', + 'PASSWORD_SCHEME': 'PBKDF2', 'LOG_LEVEL': 'WARNING', # Host settings 'HOST_IMAP': 'imap',
diff --git a/tests/compose/core/mailu.env b/tests/compose/core/mailu.env --- a/tests/compose/core/mailu.env +++ b/tests/compose/core/mailu.env @@ -129,8 +129,8 @@ WEBSITE=https://mailu.io COMPOSE_PROJECT_NAME=mailu # Default password scheme used for newly created accounts and changed passwords -# (value: BLF-CRYPT, SHA512-CRYPT, SHA256-CRYPT, MD5-CRYPT, CRYPT) -PASSWORD_SCHEME=BLF-CRYPT +# (value: PBKDF2, BLF-CRYPT, SHA512-CRYPT, SHA256-CRYPT) +PASSWORD_SCHEME=PBKDF2 # Header to take the real ip from REAL_IP_HEADER= @@ -144,4 +144,4 @@ REJECT_UNLISTED_RECIPIENT= # Test for initial admin create INITIAL_ADMIN_ACCOUNT=admin INITIAL_ADMIN_DOMAIN=mailu.io -INITIAL_ADMIN_PW=FooBar \ No newline at end of file +INITIAL_ADMIN_PW=FooBar diff --git a/tests/compose/fetchmail/mailu.env b/tests/compose/fetchmail/mailu.env --- a/tests/compose/fetchmail/mailu.env +++ b/tests/compose/fetchmail/mailu.env @@ -129,8 +129,8 @@ WEBSITE=https://mailu.io COMPOSE_PROJECT_NAME=mailu # Default password scheme used for newly created accounts and changed passwords -# (value: BLF-CRYPT, SHA512-CRYPT, SHA256-CRYPT, MD5-CRYPT, CRYPT) -PASSWORD_SCHEME=BLF-CRYPT +# (value: PBKDF2, BLF-CRYPT, SHA512-CRYPT, SHA256-CRYPT) +PASSWORD_SCHEME=PBKDF2 # Header to take the real ip from REAL_IP_HEADER= diff --git a/tests/compose/filters/mailu.env b/tests/compose/filters/mailu.env --- a/tests/compose/filters/mailu.env +++ b/tests/compose/filters/mailu.env @@ -129,8 +129,8 @@ WEBSITE=https://mailu.io COMPOSE_PROJECT_NAME=mailu # Default password scheme used for newly created accounts and changed passwords -# (value: BLF-CRYPT, SHA512-CRYPT, SHA256-CRYPT, MD5-CRYPT, CRYPT) -PASSWORD_SCHEME=BLF-CRYPT +# (value: PBKDF2, BLF-CRYPT, SHA512-CRYPT, SHA256-CRYPT) +PASSWORD_SCHEME=PBKDF2 # Header to take the real ip from REAL_IP_HEADER= diff --git a/tests/compose/rainloop/mailu.env b/tests/compose/rainloop/mailu.env --- a/tests/compose/rainloop/mailu.env +++ b/tests/compose/rainloop/mailu.env @@ -129,8 +129,8 @@ WEBSITE=https://mailu.io COMPOSE_PROJECT_NAME=mailu # Default password scheme used for newly created accounts and changed passwords -# (value: BLF-CRYPT, SHA512-CRYPT, SHA256-CRYPT, MD5-CRYPT, CRYPT) -PASSWORD_SCHEME=BLF-CRYPT +# (value: PBKDF2, BLF-CRYPT, SHA512-CRYPT, SHA256-CRYPT) +PASSWORD_SCHEME=PBKDF2 # Header to take the real ip from REAL_IP_HEADER= diff --git a/tests/compose/roundcube/mailu.env b/tests/compose/roundcube/mailu.env --- a/tests/compose/roundcube/mailu.env +++ b/tests/compose/roundcube/mailu.env @@ -129,8 +129,8 @@ WEBSITE=https://mailu.io COMPOSE_PROJECT_NAME=mailu # Default password scheme used for newly created accounts and changed passwords -# (value: BLF-CRYPT, SHA512-CRYPT, SHA256-CRYPT, MD5-CRYPT, CRYPT) -PASSWORD_SCHEME=BLF-CRYPT +# (value: PBKDF2, BLF-CRYPT, SHA512-CRYPT, SHA256-CRYPT) +PASSWORD_SCHEME=PBKDF2 # Header to take the real ip from REAL_IP_HEADER= diff --git a/tests/compose/webdav/mailu.env b/tests/compose/webdav/mailu.env --- a/tests/compose/webdav/mailu.env +++ b/tests/compose/webdav/mailu.env @@ -129,8 +129,8 @@ WEBSITE=https://mailu.io COMPOSE_PROJECT_NAME=mailu # Default password scheme used for newly created accounts and changed passwords -# (value: BLF-CRYPT, SHA512-CRYPT, SHA256-CRYPT, MD5-CRYPT, CRYPT) -PASSWORD_SCHEME=BLF-CRYPT +# (value: PBKDF2, BLF-CRYPT, SHA512-CRYPT, SHA256-CRYPT) +PASSWORD_SCHEME=PBKDF2 # Header to take the real ip from REAL_IP_HEADER=
refining the default password scheme In https://github.com/Mailu/Mailu/pull/647 the default scheme was switched to BCRYPT. The argumentation was: > bcrypt is fastยน and secure[...] While it's actually secure, bcypt is not fast. It is _designed_ to be slow - to consume a very high amount of CPU resources to make brute-force attacs expensive. Unfortunately, such a password scheme is not a good choice for a stateless system where many auth checks are done in a very short time. The current bcrypt strength of 12 consumes ~0.7s of CPU time for each authentication. This might work for low-volume sites but can easily max out multiple cpus if there's some user traffic. We should default to something alternative like PBKDF2 that ensures fast response times for auth requests.
2019-10-07T20:45:14
Mailu/Mailu
1,198
Mailu__Mailu-1198
[ "1197" ]
45126624c2f9e1722708e80f7e951b9c83eb5d21
diff --git a/core/admin/start.py b/core/admin/start.py --- a/core/admin/start.py +++ b/core/admin/start.py @@ -1,6 +1,10 @@ #!/usr/bin/python3 import os +import logging as log +import sys + +log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", "INFO")) os.system("flask mailu advertise") os.system("flask db upgrade") @@ -11,6 +15,14 @@ if account is not None and domain is not None and password is not None: mode = os.environ.get("INITIAL_ADMIN_MODE", default="ifmissing") + log.info("Creating initial admin accout %s@%s with mode %s",account,domain,mode) os.system("flask mailu admin %s %s '%s' --mode %s" % (account, domain, password, mode)) -os.system("gunicorn -w 4 -b :80 --access-logfile - --error-logfile - --preload 'mailu:create_app()'") +start_command="".join([ + "gunicorn -w 4 -b :80 ", + "--access-logfile - " if (log.root.level<=log.INFO) else "", + "--error-logfile - ", + "--preload ", + "'mailu:create_app()'"]) + +os.system(start_command)
Make access logging of admin server dependent on log level Currently, admin logs all access logs to the console, regardless of which log level is set. This is caused by starting gunicorn with `--access-logfile -`. This should be switched dependent on the log level set, e.g. on for levels >= INFO and off for <=WARNING
2019-10-08T05:30:42
Mailu/Mailu
1,268
Mailu__Mailu-1268
[ "1157" ]
9db709515a45afbbc1045a079c5e64498d631fd7
diff --git a/webmails/roundcube/start.py b/webmails/roundcube/start.py --- a/webmails/roundcube/start.py +++ b/webmails/roundcube/start.py @@ -4,16 +4,61 @@ import logging as log import sys from socrate import conf +import subprocess log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", "WARNING")) os.environ["MAX_FILESIZE"] = str(int(int(os.environ.get("MESSAGE_SIZE_LIMIT"))*0.66/1048576)) +db_flavor=os.environ.get("ROUNDCUBE_DB_FLAVOR",os.environ.get("DB_FLAVOR","sqlite")) +if db_flavor=="sqlite": + os.environ["DB_DSNW"]="sqlite:////data/roundcube.db" +elif db_flavor=="mysql": + os.environ["DB_DSNW"]="mysql://%s:%s@%s/%s" % ( + os.environ.get("ROUNDCUBE_DB_USER","roundcube"), + os.environ.get("ROUNDCUBE_DB_PW"), + os.environ.get("ROUNDCUBE_DB_HOST",os.environ.get("DB_HOST","database")), + os.environ.get("ROUNDCUBE_DB_NAME","roundcube") + ) +elif db_flavor=="postgresql": + os.environ["DB_DSNW"]="pgsql://%s:%s@%s/%s" % ( + os.environ.get("ROUNDCUBE_DB_USER","roundcube"), + os.environ.get("ROUNDCUBE_DB_PW"), + os.environ.get("ROUNDCUBE_DB_HOST",os.environ.get("DB_HOST","database")), + os.environ.get("ROUNDCUBE_DB_NAME","roundcube") + ) +else: + print("Unknown ROUNDCUBE_DB_FLAVOR: %s",db_flavor) + exit(1) + + + conf.jinja("/php.ini", os.environ, "/usr/local/etc/php/conf.d/roundcube.ini") # Fix some permissions -os.system("mkdir -p /data/gpg") -os.system("chown -R www-data:www-data /data") +os.system("mkdir -p /data/gpg /var/www/html/logs") +os.system("touch /var/www/html/logs/errors") +os.system("chown -R www-data:www-data /data /var/www/html/logs") + +try: + print("Initializing database") + result=subprocess.check_output(["/var/www/html/bin/initdb.sh","--dir","/var/www/html/SQL"],stderr=subprocess.STDOUT) + print(result.decode()) +except subprocess.CalledProcessError as e: + if "already exists" in e.stdout.decode(): + print("Already initialzed") + else: + print(e.stdout.decode()) + quit(1) + +try: + print("Upgrading database") + subprocess.check_call(["/var/www/html/bin/update.sh","--version=?","-y"],stderr=subprocess.STDOUT) +except subprocess.CalledProcessError as e: + quit(1) + +# Tail roundcube logs +subprocess.Popen(["tail","-f","-n","0","/var/www/html/logs/errors"]) # Run apache os.execv("/usr/local/bin/apache2-foreground", ["apache2-foreground"])
Make roundcube log to the console Roundcube is currently hard to debug because it logs into a special folder (/var/www/html/logs). It should log to stdout/stderr instead.
2019-11-21T22:30:47
Mailu/Mailu
1,296
Mailu__Mailu-1296
[ "1295" ]
b8b1699f9ebf66e2691fee846bad9cc620ceafba
diff --git a/optional/fetchmail/fetchmail.py b/optional/fetchmail/fetchmail.py --- a/optional/fetchmail/fetchmail.py +++ b/optional/fetchmail/fetchmail.py @@ -8,6 +8,7 @@ import re import requests import sys +import traceback FETCHMAIL = """ @@ -45,47 +46,50 @@ def fetchmail(fetchmailrc): def run(debug): - fetches = requests.get("http://admin/internal/fetch").json() - smtphost, smtpport = extract_host_port(os.environ.get("HOST_SMTP", "smtp"), None) - if smtpport is None: - smtphostport = smtphost - else: - smtphostport = "%s/%d" % (smtphost, smtpport) - for fetch in fetches: - fetchmailrc = "" - options = "options antispam 501, 504, 550, 553, 554" - options += " sslmode wrapped" if fetch["tls"] else "" - options += " keep" if fetch["keep"] else " fetchall" - fetchmailrc += RC_LINE.format( - user_email=escape_rc_string(fetch["user_email"]), - protocol=fetch["protocol"], - host=escape_rc_string(fetch["host"]), - port=fetch["port"], - smtphost=smtphostport, - username=escape_rc_string(fetch["username"]), - password=escape_rc_string(fetch["password"]), - options=options - ) - if debug: - print(fetchmailrc) - try: - print(fetchmail(fetchmailrc)) - error_message = "" - except subprocess.CalledProcessError as error: - error_message = error.output.decode("utf8") - # No mail is not an error - if not error_message.startswith("fetchmail: No mail"): - print(error_message) - user_info = "for %s at %s" % (fetch["user_email"], fetch["host"]) - # Number of messages seen is not a error as well - if ("messages" in error_message and - "(seen " in error_message and - user_info in error_message): - print(error_message) - finally: - requests.post("http://admin/internal/fetch/{}".format(fetch["id"]), - json=error_message.split("\n")[0] + try: + fetches = requests.get("http://admin/internal/fetch").json() + smtphost, smtpport = extract_host_port(os.environ.get("HOST_SMTP", "smtp"), None) + if smtpport is None: + smtphostport = smtphost + else: + smtphostport = "%s/%d" % (smtphost, smtpport) + for fetch in fetches: + fetchmailrc = "" + options = "options antispam 501, 504, 550, 553, 554" + options += " sslmode wrapped" if fetch["tls"] else "" + options += " keep" if fetch["keep"] else " fetchall" + fetchmailrc += RC_LINE.format( + user_email=escape_rc_string(fetch["user_email"]), + protocol=fetch["protocol"], + host=escape_rc_string(fetch["host"]), + port=fetch["port"], + smtphost=smtphostport, + username=escape_rc_string(fetch["username"]), + password=escape_rc_string(fetch["password"]), + options=options ) + if debug: + print(fetchmailrc) + try: + print(fetchmail(fetchmailrc)) + error_message = "" + except subprocess.CalledProcessError as error: + error_message = error.output.decode("utf8") + # No mail is not an error + if not error_message.startswith("fetchmail: No mail"): + print(error_message) + user_info = "for %s at %s" % (fetch["user_email"], fetch["host"]) + # Number of messages seen is not a error as well + if ("messages" in error_message and + "(seen " in error_message and + user_info in error_message): + print(error_message) + finally: + requests.post("http://admin/internal/fetch/{}".format(fetch["id"]), + json=error_message.split("\n")[0] + ) + except Exception: + traceback.print_exc() if __name__ == "__main__":
fetchmail crashes due to exception ``` Traceback (most recent call last): File "/fetchmail.py", line 93, in <module> run(os.environ.get("DEBUG", None) == "True") File "/fetchmail.py", line 47, in run fetches = requests.get("http://admin/internal/fetch").json() File "/usr/lib/python3.7/site-packages/requests/models.py", line 897, in json return complexjson.loads(self.text, **kwargs) File "/usr/lib/python3.7/json/__init__.py", line 348, in loads return _default_decoder.decode(s) File "/usr/lib/python3.7/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python3.7/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) ```
I'll fix it by myself. Feel free to assign this to me.
2019-12-26T09:04:58
Mailu/Mailu
1,299
Mailu__Mailu-1299
[ "982" ]
5d20f2893aaa8b25a429ed2b895dee599c6f0de1
diff --git a/core/admin/mailu/models.py b/core/admin/mailu/models.py --- a/core/admin/mailu/models.py +++ b/core/admin/mailu/models.py @@ -277,12 +277,14 @@ def resolve_destination(cls, localpart, domain_name, ignore_forward_keep=False): if not user and localpart_stripped: user = User.query.get('{}@{}'.format(localpart_stripped, domain_name)) if user: + email = '{}@{}'.format(localpart, domain_name) + if user.forward_enabled: destination = user.forward_destination if user.forward_keep or ignore_forward_keep: - destination.append(user.email) + destination.append(email) else: - destination = [user.email] + destination = [email] return destination pure_alias = Alias.resolve(localpart, domain_name)
sieve filtering based on recipient_delimiter no longer works in 1.6 I have a sieve rule setup to automatically sort mails into folders based on the part after the recipient delimiter, so mail to `[email protected]` would get sorted into folder `bar` provided it exists. The rule for this is as follows: ``` require ["envelope","fileinto","subaddress","variables"]; if envelope :detail :matches "to" "*" { fileinto "${1}"; } ``` This worked fine in Mailu 1.5, but ever since upgrading to 1.6 all those mails get filed just into `INBOX`. Sieve evaluation itself is working, as other rules get applied properly.
I did some further digging and the recipient address in the envelope gets rewritten to the canonical user address when the mail is forwarded via LMTP to dovecot. Relevant header in 1.5: ``` Received: from mail.example.com ([172.18.0.10]) by mail.example.com with LMTP id mOZHIEl4i1zFRgAAkeXSCA for <[email protected]>; Fri, 15 Mar 2019 10:02:49 +0000 ... To: [email protected] ``` Header after the upgrade to 1.6: ``` Received: from mail.example.com ([172.18.0.12]) by mail.example.com with LMTP id wG8HKAluj1zCXAAAfVZfzA (envelope-from <redacted>) for <[email protected]>; Mon, 18 Mar 2019 10:08:09 +0000 ... To: [email protected] ``` I think that rewrite was introduced in #778 to fix #755. Is there a way to pass the envelope information to dovecot again to allow the aforementioned filtering based on the detail part? I'm setting up a new Mailu installation (so running 1.7) and migrating over some Sieve scripts from a previous mail setup (not Mailu). And I still seem to be able to confirm this? At least it's not working and I'm seeing the same in the mail headers where the address extension / recipient delimiter is removed in the last part (LMTP delivery from Postfix to Dovecot).
2019-12-27T20:23:50
Mailu/Mailu
1,305
Mailu__Mailu-1305
[ "1302" ]
5d20f2893aaa8b25a429ed2b895dee599c6f0de1
diff --git a/core/nginx/certwatcher.py b/core/nginx/certwatcher.py --- a/core/nginx/certwatcher.py +++ b/core/nginx/certwatcher.py @@ -8,7 +8,7 @@ from os.path import exists, split as path_split from os import system import time -from watchdog.observers import Observer +from watchdog.observers.polling import PollingObserver from watchdog.events import FileSystemEventHandler, FileDeletedEvent, \ FileCreatedEvent, FileModifiedEvent, FileMovedEvent @@ -49,7 +49,7 @@ def on_any_event(self, event): if __name__ == '__main__': - observer = Observer() + observer = PollingObserver() handler = ChangeHandler() observer.schedule(handler, "/certs", recursive=False) observer.start()
Certwatcher does not work with symlinks (on Kubernetes) I need to recheck this, but I just had this issue... Will report in 3 Months
I can confirm it, the certs in k8s are renewed but nginx is not reloaded. I did not restart it yet to have the option to debug it further Looks like an issue in certwatcher, dealing with symlinks: ``` bash-5.0# ls -al /certs total 4 drwxrwxrwt 3 root root 120 Dec 30 07:21 . drwxr-xr-x 1 root root 4096 Nov 30 08:24 .. drwxr-xr-x 2 root root 80 Dec 30 07:21 ..2019_12_30_07_21_59.992633671 lrwxrwxrwx 1 root root 31 Dec 30 07:21 ..data -> ..2019_12_30_07_21_59.992633671 lrwxrwxrwx 1 root root 15 Nov 30 08:24 cert.pem -> ..data/cert.pem lrwxrwxrwx 1 root root 14 Nov 30 08:24 key.pem -> ..data/key.pem ``` We need to investigate in it, create a test case with symlinks, get it fixed. I did some manual tests: - Direct symlinks works (e.g. cert.pem linked to cert1.pem, then re-linked to cert2.pem triggers the reload/reconfig). - Indirect symlinks (cert.pem linked to a symlink or symlinked directory which target is changed) are not detected So the problem here is the way kubernetes changes the symlink.
2020-01-04T13:41:33
Mailu/Mailu
1,316
Mailu__Mailu-1316
[ "1139" ]
869f230e0defc2f5ed564e9322a5f9e71880d2b0
diff --git a/core/admin/mailu/internal/nginx.py b/core/admin/mailu/internal/nginx.py --- a/core/admin/mailu/internal/nginx.py +++ b/core/admin/mailu/internal/nginx.py @@ -37,8 +37,14 @@ def handle_authentication(headers): # Authenticated user elif method == "plain": server, port = get_server(headers["Auth-Protocol"], True) - user_email = urllib.parse.unquote(headers["Auth-User"]) - password = urllib.parse.unquote(headers["Auth-Pass"]) + # According to RFC2616 section 3.7.1 and PEP 3333, HTTP headers should + # be ASCII and are generally considered ISO8859-1. However when passing + # the password, nginx does not transcode the input UTF string, thus + # we need to manually decode. + raw_user_email = urllib.parse.unquote(headers["Auth-User"]) + user_email = raw_user_email.encode("iso8859-1").decode("utf8") + raw_password = urllib.parse.unquote(headers["Auth-Pass"]) + password = raw_password.encode("iso8859-1").decode("utf8") ip = urllib.parse.unquote(headers["Client-Ip"]) user = models.User.query.get(user_email) status = False
Rainloop Webmail - Authentication fails if you have a special character in your password In the admin interface, you can define a new password and you can put a special character like `รจ`. It works fine with admin interface but it doesn't work at all with the Rainloop webmail. If you try to log in, you will have a message to indicate that the authentication fails, see screenshoot in french: ![Capture dโ€™รฉcran de 2019-08-25 10-57-56](https://user-images.githubusercontent.com/21110485/63647853-904b0b80-c727-11e9-9938-d66a1e10ca4e.png)
Same for me with "password" ... @fldu My issue is about the password with a special character not the username (even if hidden in my screenshot). and if your password is "password" it should work afaik :) @Angedestenebres no, i checked, but maybe a variable was added and I didn't set it... for the moment i rolled back and it works Really, standard password should work, if they do not, then your setup is probably broken somewhere. Please open a separate issue if you struggle with it or come and discuss it on our matrix chan.
2020-01-13T19:39:58
Mailu/Mailu
1,337
Mailu__Mailu-1337
[ "1336" ]
b248f6a800952e5d5a8ba301c5ad89df3be7e523
diff --git a/core/admin/mailu/configuration.py b/core/admin/mailu/configuration.py --- a/core/admin/mailu/configuration.py +++ b/core/admin/mailu/configuration.py @@ -67,6 +67,7 @@ 'HOST_REDIS': 'redis', 'HOST_FRONT': 'front', 'SUBNET': '192.168.203.0/24', + 'SUBNET6': None, 'POD_ADDRESS_RANGE': None } diff --git a/core/admin/mailu/internal/views/dovecot.py b/core/admin/mailu/internal/views/dovecot.py --- a/core/admin/mailu/internal/views/dovecot.py +++ b/core/admin/mailu/internal/views/dovecot.py @@ -11,6 +11,8 @@ def dovecot_passdb_dict(user_email): user = models.User.query.get(user_email) or flask.abort(404) allow_nets = [] allow_nets.append(app.config["SUBNET"]) + if app.config["SUBNET6"]: + allow_nets.append(app.config["SUBNET6"]) if app.config["POD_ADDRESS_RANGE"]: allow_nets.append(app.config["POD_ADDRESS_RANGE"]) return flask.jsonify({
Roundcube managesieve fails on IPv6 I have assigned a globally-routable IPv6 network to the docker-compose stack. Rainloop sieve management works correctly but Roundcube fails. Looking at the logs, Roundcube attempts to connect to sieve via IPv6. Hard-coding $imap to the IPv4 address of the imap docker container allows Roundcube sieve to function properly. I believe it is related to this in the debug log of imap: `DEBUG:root:Table get passdb/[username redated] is {'allow_nets': '192.168.203.0/24', 'nopassword': 'Y', 'password': None}` Using version 1.7.
My current workaround is setting the POD_ADDRESS_RANGE to the same value as SUBNET6. Ignore that. That breaks SMTP.
2020-02-03T21:54:20
Mailu/Mailu
1,349
Mailu__Mailu-1349
[ "328" ]
b248f6a800952e5d5a8ba301c5ad89df3be7e523
diff --git a/core/admin/mailu/internal/views/postfix.py b/core/admin/mailu/internal/views/postfix.py --- a/core/admin/mailu/internal/views/postfix.py +++ b/core/admin/mailu/internal/views/postfix.py @@ -3,6 +3,7 @@ import flask import re +import srslib @internal.route("/postfix/domain/<domain_name>") @@ -39,6 +40,38 @@ def postfix_transport(email): return flask.jsonify("smtp:[{}]".format(relay.smtp)) [email protected]("/postfix/recipient/map/<path:recipient>") +def postfix_recipient_map(recipient): + """ Rewrite the envelope recipient if it is a valid SRS address. + + This is meant for bounces to go back to the original sender. + """ + srs = srslib.SRS(flask.current_app.config["SECRET_KEY"]) + if srslib.SRS.is_srs_address(recipient): + try: + return flask.jsonify(srs.reverse(recipient)) + except srslib.Error as error: + return flask.abort(404) + return flask.abort(404) + + [email protected]("/postfix/sender/map/<path:sender>") +def postfix_sender_map(sender): + """ Rewrite the envelope sender in case the mail was not emitted by us. + + This is for bounces to come back the reverse path properly. + """ + srs = srslib.SRS(flask.current_app.config["SECRET_KEY"]) + domain = flask.current_app.config["DOMAIN"] + try: + localpart, domain_name = models.Email.resolve_domain(sender) + except Exception as error: + return flask.abort(404) + if models.Domain.query.get(domain_name): + return flask.abort(404) + return flask.jsonify(srs.forward(sender, domain)) + + @internal.route("/postfix/sender/login/<path:sender>") def postfix_sender_login(sender): localpart, domain_name = models.Email.resolve_domain(sender) diff --git a/core/postfix/start.py b/core/postfix/start.py --- a/core/postfix/start.py +++ b/core/postfix/start.py @@ -21,6 +21,8 @@ def start_podop(): ("alias", "url", url + "alias/ยง"), ("domain", "url", url + "domain/ยง"), ("mailbox", "url", url + "mailbox/ยง"), + ("recipientmap", "url", url + "recipient/map/ยง"), + ("sendermap", "url", url + "sender/map/ยง"), ("senderaccess", "url", url + "sender/access/ยง"), ("senderlogin", "url", url + "sender/login/ยง") ])
Support for SRS See https://en.wikipedia.org/wiki/Sender_Rewriting_Scheme and https://github.com/roehling/postsrsd
That would be an interesting feature for aliases and forwards indeed. No idea how soon we could support it though. It would greatly diminish the risk of the forwarding MTA to be marked as Spammer. Is this still valid, especially in conjunction with DKIM/DMARC? Edit: https://fastmail.blog/2016/12/24/spf-dkim-dmarc/ > The solution: always make sure you DKIM sign mail if you have a DMARC policy. If your email is forwarded, SPF will break, but DKIM signatures should survive. SRS wonสผt help with DMARC, because replacing the MAIL FROM envelope with your own domain means the MAIL FROM domain doesnสผt match the From header domain. This is an alignment failure, and so not a pass result for DMARC. Seems this is superseded by DMARC @kaiyou in #1042 you posted some review comments. @jbmolle are you able to proceed with this? I would like to help if possible as this is currently a problem for an alias I need to use. A completely different approach would be to use a podop map and generate the srs in the admin container instead of running postsrs. It has the advantage of being compatible with replicated setups. If @jbmolle can adjust the pr, we can probably merge it. Otherwise I'd go for the podop map instead. How do you feel about contributing it if I try and guide you through it? @kaiyou I would like to try. Itโ€™s a new area for me though and it could take some time to catch up. I will try and setup the dev environment while waiting for an answer of @jbmolle. Hi @oli-ver, hi @kaiyou , Sorry for the late reply. I haven't looked much at this issue. The modifications I did were enough for the use case I had so far. But I can look at it again and try to modify the PR according to kaiyou's suggestions. I don't write much code in Python so I might not be the best to do but I can try and you'll let me know if it's fine. @jbmolle I have some experience with python but none with mailu development but I am open to review code and discuss solutions. @kaiyou, what do you think? I planned on setting up a nee dev environment tonight. Let's try and make this my first issue. Postfix sender and recipient canonical maps should be bound to admin through podop, and rewriting will be implemented using pysrs from https://pythonhosted.org/milter/pysrs.html as it seems not to be the best but most supported lib.
2020-02-07T14:17:57
Mailu/Mailu
1,358
Mailu__Mailu-1358
[ "1357", "1357" ]
770d09b05b6552edc4d0ebf44771a16087d38454
diff --git a/core/admin/mailu/internal/views/postfix.py b/core/admin/mailu/internal/views/postfix.py --- a/core/admin/mailu/internal/views/postfix.py +++ b/core/admin/mailu/internal/views/postfix.py @@ -36,7 +36,11 @@ def postfix_transport(email): return flask.abort(404) localpart, domain_name = models.Email.resolve_domain(email) relay = models.Relay.query.get(domain_name) or flask.abort(404) - return flask.jsonify("smtp:[{}]".format(relay.smtp)) + ret = "smtp:[{0}]".format(relay.smtp) + if ":" in relay.smtp: + split = relay.smtp.split(':') + ret = "smtp:[{0}]:{1}".format(split[0], split[1]) + return flask.jsonify(ret) @internal.route("/postfix/sender/login/<path:sender>")
Add ability to specify SMTP port Some relayed domains may live on machines that accept SMTP on a nonstandard port, e.g., port 2525. This would allow users to relay for domains by appending `:port` to the hostname or IP address. Add ability to specify SMTP port Some relayed domains may live on machines that accept SMTP on a nonstandard port, e.g., port 2525. This would allow users to relay for domains by appending `:port` to the hostname or IP address.
2020-02-09T15:07:52
Mailu/Mailu
1,389
Mailu__Mailu-1389
[ "1387" ]
cc4720d890bf541db04aace1d3fc4726b0154615
diff --git a/core/admin/mailu/models.py b/core/admin/mailu/models.py --- a/core/admin/mailu/models.py +++ b/core/admin/mailu/models.py @@ -451,25 +451,34 @@ def resolve(cls, localpart, domain_name): ) ) ).order_by(cls.wildcard, sqlalchemy.func.char_length(cls.localpart).desc()).first() - if alias_preserve_case: - return alias_preserve_case - if localpart: - localpart = localpart.lower() - return cls.query.filter( + localpart_lower = localpart.lower() if localpart else None + alias_lower_case = cls.query.filter( sqlalchemy.and_(cls.domain_name == domain_name, sqlalchemy.or_( sqlalchemy.and_( cls.wildcard == False, - sqlalchemy.func.lower(cls.localpart) == localpart + sqlalchemy.func.lower(cls.localpart) == localpart_lower ), sqlalchemy.and_( cls.wildcard == True, - sqlalchemy.bindparam("l", localpart).like(sqlalchemy.func.lower(cls.localpart)) + sqlalchemy.bindparam("l", localpart_lower).like(sqlalchemy.func.lower(cls.localpart)) ) ) ) ).order_by(cls.wildcard, sqlalchemy.func.char_length(sqlalchemy.func.lower(cls.localpart)).desc()).first() + if alias_preserve_case and alias_lower_case: + if alias_preserve_case.wildcard: + return alias_lower_case + else: + return alias_preserve_case + elif alias_preserve_case and not alias_lower_case: + return alias_preserve_case + elif alias_lower_case and not alias_preserve_case: + return alias_lower_case + else: + return None + class Token(Base): """ A token is an application password for a given user. """
Case insensitiveness broken for aliases If thereโ€™s a catchall (`foo%`) as well as a specific alias (`foobar`) on a domain, and a mail arrives for that alias, but in a different case (`FOOBAR`), it is delivered to the catchall instead of the specific alias. If the mail arrives in the correct case, the specific alias is chosen. This is inconsistent behavior (โ€ฆ and endlessly unnerving with airlines and the likes), so brace for a hopefully-soon-to-come PR ^_^.
2020-03-06T12:58:36
Mailu/Mailu
1,392
Mailu__Mailu-1392
[ "903" ]
b8b1699f9ebf66e2691fee846bad9cc620ceafba
diff --git a/core/nginx/certwatcher.py b/core/nginx/certwatcher.py --- a/core/nginx/certwatcher.py +++ b/core/nginx/certwatcher.py @@ -5,8 +5,8 @@ of TLS_FLAVOR=[mail, cert] """ -from os.path import exists, split as path_split -from os import system +from os.path import exists, split as path_split, join as path_join +from os import system, getenv import time from watchdog.observers.polling import PollingObserver from watchdog.events import FileSystemEventHandler, FileDeletedEvent, \ @@ -14,6 +14,13 @@ class ChangeHandler(FileSystemEventHandler): "watchdog-handler listening on any event, executing the correct configuration/reload steps" + + def __init__(self, cert_path, keypair_path): + "Initialize a new changehandler""" + super().__init__() + self.cert_path = cert_path + self.keypair_path = keypair_path + @staticmethod def reload_nginx(): "merely reload nginx without re-configuring everything" @@ -32,11 +39,11 @@ def on_any_event(self, event): if event.is_directory: return - filename = path_split(event.src_path)[-1] + filename = event.src_path if isinstance(event, FileMovedEvent): - filename = path_split(event.dest_path)[-1] + filename = event.dest_path - if filename in ['cert.pem', 'key.pem']: + if filename in [self.cert_path, self.keypair_path]: # all cases except for FileModified need re-configure if isinstance(event, (FileCreatedEvent, FileMovedEvent, FileDeletedEvent)): ChangeHandler.reexec_config() @@ -44,14 +51,21 @@ def on_any_event(self, event): elif isinstance(event, FileModifiedEvent): ChangeHandler.reload_nginx() # cert files have been moved away, re-configure - elif isinstance(event, FileMovedEvent) and path_split(event.src_path)[-1] in ['cert.pem', 'key.pem']: + elif isinstance(event, FileMovedEvent) and event.src_path in [self.cert_path, self.keypair_path]: ChangeHandler.reexec_config() if __name__ == '__main__': + cert_path = path_join("/certs/", getenv("TLS_CERT_FILENAME", default="cert.pem")) + cert_dir = path_split(cert_path)[0] + keypair_path = path_join("/certs/", getenv("TLS_KEYPAIR_FILENAME", default="key.pem")) + keypair_dir = path_split(keypair_path)[0] + observer = PollingObserver() - handler = ChangeHandler() - observer.schedule(handler, "/certs", recursive=False) + handler = ChangeHandler(cert_path, keypair_path) + observer.schedule(handler, cert_dir, recursive=False) + if keypair_dir != cert_dir: + observer.schedule(handler, keypair_dir, recursive=False) observer.start() try:
certwatcher.py is not using TLS_CERT_FILENAME nor TLS_KEYPAIR_FILENAME certwatcher.py is assuming that the certificate and the key are in /certs and named respectively cert.pem and key.pem However, Mailu offer two environment variables to allow specific path & filename for the certificate and the key which are used in config.py: TLS_CERT_FILENAME TLS_KEYPAIR_FILENAME I would add that in my use case (https-portal as a reverse proxy), those files are not directly in /certs. My environment variables look like: TLS_CERT_FILENAME=mail.example.net/production/signed.crt TLS_KEYPAIR_FILENAME=mail.example.net/production/domain.key Currently, certwatcher.py is monitoring `/certs`, whereas I would need to monitor `/certs/mail.example.net/production`
2020-03-07T17:19:28
Mailu/Mailu
1,393
Mailu__Mailu-1393
[ "1098" ]
b8b1699f9ebf66e2691fee846bad9cc620ceafba
diff --git a/core/postfix/start.py b/core/postfix/start.py --- a/core/postfix/start.py +++ b/core/postfix/start.py @@ -27,6 +27,10 @@ def start_podop(): ("senderlogin", "url", url + "sender/login/ยง") ]) +def is_valid_postconf_line(line): + return not line.startswith("#") \ + and not line == '' + # Actual startup script os.environ["FRONT_ADDRESS"] = system.get_host_address_from_environment("FRONT", "front") os.environ["ADMIN_ADDRESS"] = system.get_host_address_from_environment("ADMIN", "admin") @@ -38,11 +42,13 @@ def start_podop(): if os.path.exists("/overrides/postfix.cf"): for line in open("/overrides/postfix.cf").read().strip().split("\n"): - os.system('postconf -e "{}"'.format(line)) + if is_valid_postconf_line(line): + os.system('postconf -e "{}"'.format(line)) if os.path.exists("/overrides/postfix.master"): for line in open("/overrides/postfix.master").read().strip().split("\n"): - os.system('postconf -Me "{}"'.format(line)) + if is_valid_postconf_line(line): + os.system('postconf -Me "{}"'.format(line)) for map_file in glob.glob("/overrides/*.map"): destination = os.path.join("/etc/postfix", os.path.basename(map_file))
Postconf overrides should ignore comments Comment lines in overrides/postfix.cf are sent to postconf in core/postfix/start.py:37. This results in error messages. Comment lines should be ignored by core/postfix/start.py.
Also empty newlines as well.
2020-03-07T18:23:16
Mailu/Mailu
1,396
Mailu__Mailu-1396
[ "1085" ]
b8b1699f9ebf66e2691fee846bad9cc620ceafba
diff --git a/core/admin/mailu/manage.py b/core/admin/mailu/manage.py --- a/core/admin/mailu/manage.py +++ b/core/admin/mailu/manage.py @@ -177,7 +177,7 @@ def config_update(verbose=False, delete_objects=False): """sync configuration with data from YAML-formatted stdin""" import yaml import sys - new_config = yaml.load(sys.stdin) + new_config = yaml.safe_load(sys.stdin) # print new_config domains = new_config.get('domains', []) tracked_domains = set()
Default yaml.load deprecated and unsafe I've come across the following warnings in the [travis logs](https://travis-ci.org/Mailu/Mailu/jobs/563724185#L3319): ``` /app/mailu/manage.py:158: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details. ``` This refers to the following snippet: https://github.com/Mailu/Mailu/blob/2788909a134217f2e5516fff938df55b644c258c/core/admin/mailu/manage.py#L158 Upstream notice: https://msg.pyyaml.org/load And a related CVE: https://nvd.nist.gov/vuln/detail/CVE-2017-18342
2020-03-07T19:10:11
Mailu/Mailu
1,487
Mailu__Mailu-1487
[ "1486" ]
cde7cb13850f41c791a6e7568f0a70744f4c90f5
diff --git a/core/postfix/start.py b/core/postfix/start.py --- a/core/postfix/start.py +++ b/core/postfix/start.py @@ -64,4 +64,7 @@ def is_valid_postconf_line(line): # Run Podop and Postfix multiprocessing.Process(target=start_podop).start() os.system("/usr/libexec/postfix/post-install meta_directory=/etc/postfix create-missing") +# Before starting postfix, we need to check permissions on /queue +# in the event that postfix,postdrop id have changed +os.system("postfix set-permissions") os.system("postfix start-fg")
We need to check the (persistent) postfix mailqueue permissions As the postfix and postdrop uid/gid might change (especially with a change of base image), it is needed to check the directory permissions on /queue before starting postfix
2020-05-04T19:01:06
Mailu/Mailu
1,542
Mailu__Mailu-1542
[ "1112" ]
4c9a4b282468dae772bbf1a78851a9e78213768c
diff --git a/core/dovecot/start.py b/core/dovecot/start.py --- a/core/dovecot/start.py +++ b/core/dovecot/start.py @@ -21,13 +21,9 @@ def start_podop(): ]) # Actual startup script - os.environ["FRONT_ADDRESS"] = system.get_host_address_from_environment("FRONT", "front") -os.environ["REDIS_ADDRESS"] = system.get_host_address_from_environment("REDIS", "redis") os.environ["ADMIN_ADDRESS"] = system.get_host_address_from_environment("ADMIN", "admin") os.environ["ANTISPAM_WEBUI_ADDRESS"] = system.get_host_address_from_environment("ANTISPAM_WEBUI", "antispam:11334") -if os.environ["WEBMAIL"] != "none": - os.environ["WEBMAIL_ADDRESS"] = system.get_host_address_from_environment("WEBMAIL", "webmail") for dovecot_file in glob.glob("/conf/*.conf"): conf.jinja(dovecot_file, os.environ, os.path.join("/etc/dovecot", os.path.basename(dovecot_file)))
Dovecot does not use redis, so it should be removed from start script In core/dovecot/start.py REDIS_ADDRESS is resolved but redis is not used on dovecot. It should be removed from the script.
Same for WEBMAIL and WEBMAIL_ADDRESS ~Same for ADMIN_ADDRESS~ no, this is required ;)
2020-06-16T13:51:11
Mailu/Mailu
1,599
Mailu__Mailu-1599
[ "1323" ]
4ab977a9f1f4fd9ba536d583f6768fa739ddf4a5
diff --git a/optional/fetchmail/fetchmail.py b/optional/fetchmail/fetchmail.py --- a/optional/fetchmail/fetchmail.py +++ b/optional/fetchmail/fetchmail.py @@ -47,7 +47,7 @@ def fetchmail(fetchmailrc): def run(debug): try: - fetches = requests.get("http://admin/internal/fetch").json() + fetches = requests.get("http://" + os.environ.get("HOST_ADMIN", "admin") + "/internal/fetch").json() smtphost, smtpport = extract_host_port(os.environ.get("HOST_SMTP", "smtp"), None) if smtpport is None: smtphostport = smtphost @@ -85,7 +85,7 @@ def run(debug): user_info in error_message): print(error_message) finally: - requests.post("http://admin/internal/fetch/{}".format(fetch["id"]), + requests.post("http://" + os.environ.get("HOST_ADMIN", "admin") + "/internal/fetch/{}".format(fetch["id"]), json=error_message.split("\n")[0] ) except Exception:
Hardcoded http://admin/ in fetchmail.py I've tweaked ``docker-compose.yml`` so that all my containers related to ``mailu`` are prefixed by ``mailu-``, in order to pro-actively avoid conflict with any other containers I may eventually define in future. However, the hardcode ``http://admin/...`` below causes failure in ``fetchmail``, since my container is now named ``mailu-admin`` in my ``docker-compose.yml``, not ``admin`` as the code supposes it should be. ``` ./services/fetchmail/fetchmail.py:47: fetches = requests.get("http://admin/internal/fetch").json() ./services/fetchmail/fetchmail.py:85: requests.post("http://admin/internal/fetch/{}".format(fetch["id"]), ```
2020-08-23T12:36:26
Mailu/Mailu
1,653
Mailu__Mailu-1653
[ "1652" ]
90984c4d2bd8b0f82559f26d9837a7454626438a
diff --git a/core/admin/mailu/configuration.py b/core/admin/mailu/configuration.py --- a/core/admin/mailu/configuration.py +++ b/core/admin/mailu/configuration.py @@ -24,7 +24,7 @@ 'SQLALCHEMY_TRACK_MODIFICATIONS': False, # Statistics management 'INSTANCE_ID_PATH': '/data/instance', - 'STATS_ENDPOINT': '0.{}.stats.mailu.io', + 'STATS_ENDPOINT': '18.{}.stats.mailu.io', # Common configuration variables 'SECRET_KEY': 'changeMe', 'DOMAIN': 'mailu.io', diff --git a/docs/conf.py b/docs/conf.py --- a/docs/conf.py +++ b/docs/conf.py @@ -41,6 +41,7 @@ ('1.5', '/1.5/'), ('1.6', '/1.6/'), ('1.7', '/1.7/'), + ('1.8', '/1.8/'), ('master', '/master/') ], 'conf_py_path': '/docs/' diff --git a/setup/server.py b/setup/server.py --- a/setup/server.py +++ b/setup/server.py @@ -53,7 +53,10 @@ def build_app(path): @app.context_processor def app_context(): - return dict(versions=os.getenv("VERSIONS","master").split(',')) + return dict( + versions=os.getenv("VERSIONS","master").split(','), + stable_version = os.getenv("stable_version", "master") + ) prefix_bp = flask.Blueprint(version, __name__) prefix_bp.jinja_loader = jinja2.ChoiceLoader([
Remove setup stack "replicas" option In preparation for 1.8-rc release, and according to #1582 , remove the "replicas" option from setup step 5 in the stack deployment option. Also add an additional notice that users should review their configuration by hand, as well as a big warning about "replicas prone to data-corruption" to the "experimental" box at the top of setup. (note that replicas is just *currently* not supported.) Note that if you know what youโ€™re doing, replicas can be easily configured by hand. Relates: #1222 #1224 #1637
2020-10-03T14:06:23
Mailu/Mailu
1,758
Mailu__Mailu-1758
[ "1755" ]
4dbefe8e3a84e8f71a4a0e3615a5388ebebb08c4
diff --git a/core/admin/mailu/models.py b/core/admin/mailu/models.py --- a/core/admin/mailu/models.py +++ b/core/admin/mailu/models.py @@ -305,6 +305,7 @@ class User(Base, Email): """ __tablename__ = "user" _ctx = None + _credential_cache = {} domain = db.relationship(Domain, backref=db.backref('users', cascade='all, delete-orphan')) @@ -382,6 +383,17 @@ def get_password_context(): return User._ctx def check_password(self, password): + cache_result = self._credential_cache.get(self.get_id()) + current_salt = self.password.split('$')[3] if len(self.password.split('$')) == 5 else None + if cache_result and current_salt: + cache_salt, cache_hash = cache_result + if cache_salt == current_salt: + return hash.pbkdf2_sha256.verify(password, cache_hash) + else: + # the cache is local per gunicorn; the password has changed + # so the local cache can be invalidated + del self._credential_cache[self.get_id()] + reference = self.password # strip {scheme} if that's something mailu has added # passlib will identify *crypt based hashes just fine @@ -396,6 +408,17 @@ def check_password(self, password): self.password = new_hash db.session.add(self) db.session.commit() + + if result: + """The credential cache uses a low number of rounds to be fast. +While it's not meant to be persisted to cold-storage, no additional measures +are taken to ensure it isn't (mlock(), encrypted swap, ...) on the basis that +we have little control over GC and string interning anyways. + + An attacker that can dump the process' memory is likely to find credentials +in clear-text regardless of the presence of the cache. + """ + self._credential_cache[self.get_id()] = (self.password.split('$')[3], hash.pbkdf2_sha256.using(rounds=1).hash(password)) return result def set_password(self, password, hash_scheme=None, raw=False):
Implement a credential cache (alternative to #1758) ## What type of PR? Feature: it implements a credential cache to speedup authentication requests. ## What does this PR do? Credentials are stored in cold-storage using a slow, salted/iterated hash function to prevent offline bruteforce attacks. This creates a performance bottleneck for no valid reason (see the rationale/long version on https://github.com/Mailu/Mailu/issues/1194#issuecomment-762115549). The new credential cache makes things fast again. Keep in mind that the cache is local to each gunicorn. There is an argument to be said about making it less configurable (remove the new knobs, no new dependency) ... that is at #1758 ### Related issue(s) - close #1411 - close #1194 - close #1758 ## Prerequistes Before we can consider review and merge, please make sure the following list is done and checked. If an entry in not applicable, you can check it or remove it from the list. - [x] In case of feature or enhancement: documentation updated accordingly - [x] Unless it's docs or a minor change: add [changelog](https://mailu.io/master/contributors/guide.html#changelog) entry file.
Thanks for submitting this pull request. Bors-ng will now build test images. When it succeeds, we will continue to review and test your PR. bors try Note: if this build fails, [read this](http://mailu.io/master/contributors/environment.html#when-bors-try-fails). ## try Build succeeded: * [continuous-integration/travis-ci/push](https://travis-ci.org/github/Mailu/Mailu/builds/757953464?utm_source=github_status&utm_medium=notification) @micw Can you review this PR please? Are you okay with flask_caching as a new dependency?
2021-02-10T14:55:46
Mailu/Mailu
1,776
Mailu__Mailu-1776
[ "1588", "1815" ]
ee1301f4f8828cd8a54c71976d3c7956e4a31e10
diff --git a/core/admin/mailu/internal/views/postfix.py b/core/admin/mailu/internal/views/postfix.py --- a/core/admin/mailu/internal/views/postfix.py +++ b/core/admin/mailu/internal/views/postfix.py @@ -2,6 +2,7 @@ from mailu.internal import internal import flask +import idna import re import srslib @@ -35,13 +36,67 @@ def postfix_alias_map(alias): def postfix_transport(email): if email == '*' or re.match("(^|.*@)\[.*\]$", email): return flask.abort(404) - localpart, domain_name = models.Email.resolve_domain(email) + _, domain_name = models.Email.resolve_domain(email) relay = models.Relay.query.get(domain_name) or flask.abort(404) - ret = "smtp:[{0}]".format(relay.smtp) - if ":" in relay.smtp: - split = relay.smtp.split(':') - ret = "smtp:[{0}]:{1}".format(split[0], split[1]) - return flask.jsonify(ret) + target = relay.smtp.lower() + port = None + use_lmtp = False + use_mx = False + # strip prefixes mx: and lmtp: + if target.startswith('mx:'): + target = target[3:] + use_mx = True + elif target.startswith('lmtp:'): + target = target[5:] + use_lmtp = True + # split host:port or [host]:port + if target.startswith('['): + if use_mx or ']' not in target: + # invalid target (mx: and [] or missing ]) + flask.abort(400) + host, rest = target[1:].split(']', 1) + if rest.startswith(':'): + port = rest[1:] + elif rest: + # invalid target (rest should be :port) + flask.abort(400) + else: + if ':' in target: + host, port = target.rsplit(':', 1) + else: + host = target + # default for empty host part is mx:domain + if not host: + if not use_lmtp: + host = relay.name.lower() + use_mx = True + else: + # lmtp: needs a host part + flask.abort(400) + # detect ipv6 address or encode host + if ':' in host: + host = f'ipv6:{host}' + else: + try: + host = idna.encode(host).decode('ascii') + except idna.IDNAError: + # invalid host (fqdn not encodable) + flask.abort(400) + # validate port + if port is not None: + try: + port = int(port, 10) + except ValueError: + # invalid port (should be numeric) + flask.abort(400) + # create transport + transport = 'lmtp' if use_lmtp else 'smtp' + # use [] when not using MX lookups or host is an ipv6 address + if host.startswith('ipv6:') or (not use_lmtp and not use_mx): + host = f'[{host}]' + # create port suffix + port = '' if port is None else f':{port}' + return flask.jsonify(f'{transport}:{host}{port}') @internal.route("/postfix/recipient/map/<path:recipient>")
Mail relaying (Relayed domain) does't work when no Remote Host is configured. Description: When in the Web Administration Interface in Relayed domain, a domain is added without a Remote Host, emails for this domain fail to be relayed. When no Remote Host is configured, Mailu is supposed to relay the email message directly to the relayed domain. In case it is relevant I use the docker-compose deployment. Replication steps: 1). Deploy a standard Mailu installation (no special configuration required). 2). In the Web Administration interface, on Relayed domains page add a new relayed domain with Relayed domain name: test.mailu.io Remote Host: (blank, keep it empty). 3). Configure your email client SMTP settings to use your Mailu server on port 25 without any authentication. 4). Send an email to [email protected]. If you receive the message, server is busy try again. Then Rspamd has greylisted you. Try sending the email again in 10 to 15 minutes. It should be accepted now. 5). Check the postfix logs (docker logs --tail 100 mailu_smtp_1 ) Aug 13 22:47:32 mail postfix/smtpd[270]: A1C493E2CE1: client=<redacted>.nl[xx.xxx.xx.xxx] Aug 13 22:47:32 mail postfix/cleanup[315]: A1C493E2CE1: message-id=<[email protected]> Aug 13 22:47:33 mail postfix/qmgr[177]: A1C493E2CE1: from=<[email protected]>, size=2765, nrcpt=1 (queue active) Aug 13 22:47:33 mail postfix/smtpd[270]: disconnect from <redacted>.nl[xx.xxx.xx.xxx] ehlo=2 xclient=0/1 mail=1 rcpt=1 data=1 quit=1 commands=6/7 **Aug 13 22:47:33 mail postfix/smtp[316]: fatal: valid hostname or network address required in server description: [] Aug 13 22:47:34 mail postfix/qmgr[177]: warning: private/smtp socket: malformed response** Aug 13 22:47:34 mail postfix/qmgr[177]: warning: transport smtp failure -- see a previous warning/fatal/panic logfile record for the problem description Aug 13 22:47:34 mail postfix/master[175]: warning: process /usr/libexec/postfix/smtp pid 316 exit status 1 Aug 13 22:47:34 mail postfix/master[175]: warning: /usr/libexec/postfix/smtp: bad command startup -- throttling Aug 13 22:47:34 mail postfix/error[318]: A1C493E2CE1: to=<[email protected]>, relay=none, delay=1.6, delays=0.59/1/0/0.01, dsn=4.3.0, status=deferred (unknown mail transport error) Workaround: A workaround is to enter the hostname or IP address of the SMTP server of the relayed domain name as Remote Host. No MX lookup is performed for a hostname entered as Remote Host. For a public domain, you could use the mxtoolbox to lookup the SMTP server. E.g. in my example for test.mailu.io https://mxtoolbox.com/SuperTool.aspx?action=mx%3atest.mailu.io&run=toolpage . Entering 78.47.92.244 or test.mailu.io as Remote Host will work as a workaround for the above example. Can relay domains support relaying directly to a LMTP port? ## Before you open your issue - [x] Check if no issue or pull-request for this already exists. - [x] Check [documentation](https://mailu.io/master/) and [FAQ](https://mailu.io/master/faq.html). (Tip, use the search function on the documentation page) - [x] You understand `Mailu` is made by volunteers in their **free time** โ€” be conscise, civil and accept that delays can occur. - [x] The title of the issue should be short and simple. It should contain specific terms related to the actual issue. Be specific while writing the title. ## Environment & Versions ### Environment - [ ] docker-compose - [ ] kubernetes - [x] docker swarm ### Versions We're using the `master` docker tag. ## Description When using relay domains in the web interface, the implementation assumes the use of SMTP. However, I am trying to relay directly using another protocol, namely, LMTP (the receiver is a mailman3 instance). When I see the remote host of my relay domain to `<host>:8024`, I see `refused to talk to me: 500 Error: command "HELO" not recognized)`. The Mailu postfix relay configuration assumes another postfix on the receiving end. In my postfix configuration, I see it is possible to support a map such as `lmtp:/<ip>:<port>` and then postfix understands not to start with a `EHLO` command and pass the mail using LMTP (as far as I understand). So, would it be possible to support LMTP relaying using relay domains? ## Replication Steps - Setup any relay domain - Specify a receiving port of 8024 - Setup a receiver on port 8024 expecting LMTP-based requests ## Expected behaviour Relay domains can support LMTP. ## Logs ``` mail_example_com_smtp.1.zh0tmwq3qnjn@autonomic-swarm | May 23 09:21:25 mail postfix/smtp[378]: 63D4536B052: to=<[email protected]>, relay=lists_example_com_core[10.0.44.41]:8024, delay=1.4, delays=1.3/0.08/0.01/0, dsn=5.0.0, status=bounced (host lists_example_com_core[10.0.52.41] refused to talk to me: 500 Error: command "HELO" not recognized) ```
Hi There, The `Mailu`-Project is currently in a bit of a bind! We are short on man-power, and we need to judge if it is possible for us to put in some work on this issue. To help with that, we are currently trying to find out which issues are actively keeping users from using `Mailu`, which issues have someone who want to work on them โ€” and which issues may be less important. These a less important ones could be discarded for the time being, until the project is in a more stable and regular state once again. In order for us to better assess this, it would be helpful if you could put a **reaction on this post** (use the :smiley: icon to the top-right). - ๐Ÿ‘๏ธ if you **need this** to be able to use Mailu. Ideally, youโ€™d also be able to test this on your installation, and provide feedback โ€ฆ - ๐ŸŽ‰ if you find it a **nice bonus**, but no deal-breaker - ๐Ÿš€ if you want to **work on it yourself**! We want to keep this **voting open for 2 weeks** from now, so please help out! I have two installatioin of mailu server accordingly with documentation. Apparently when I add a relayed domain and I press the Save button nothing seems to work, just not able to add relayed domains.
2021-02-26T20:05:17
Mailu/Mailu
1,831
Mailu__Mailu-1831
[ "1648" ]
42cefab4c2607acb97c589414e0d13c8dd0d5cd8
diff --git a/optional/postgresql/start.py b/optional/postgresql/start.py --- a/optional/postgresql/start.py +++ b/optional/postgresql/start.py @@ -2,7 +2,6 @@ import anosql import psycopg2 -import jinja2 import glob import os import subprocess @@ -38,7 +37,6 @@ def setup(): rec.write("restore_command = 'gunzip < /backup/wal_archive/%f > %p'\n") rec.write("standby_mode = off\n") os.system("chown postgres:postgres /data/recovery.conf") - #os.system("sudo -u postgres pg_ctl start -D /data -o '-h \"''\" '") else: # Bootstrap the database os.system("sudo -u postgres initdb -D /data") diff --git a/webmails/roundcube/start.py b/webmails/roundcube/start.py --- a/webmails/roundcube/start.py +++ b/webmails/roundcube/start.py @@ -8,31 +8,29 @@ log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", "WARNING")) -os.environ["MAX_FILESIZE"] = str(int(int(os.environ.get("MESSAGE_SIZE_LIMIT"))*0.66/1048576)) +os.environ["MAX_FILESIZE"] = str(int(int(os.environ.get("MESSAGE_SIZE_LIMIT")) * 0.66 / 1048576)) -db_flavor=os.environ.get("ROUNDCUBE_DB_FLAVOR",os.environ.get("DB_FLAVOR","sqlite")) -if db_flavor=="sqlite": - os.environ["DB_DSNW"]="sqlite:////data/roundcube.db" -elif db_flavor=="mysql": - os.environ["DB_DSNW"]="mysql://%s:%s@%s/%s" % ( - os.environ.get("ROUNDCUBE_DB_USER","roundcube"), +db_flavor = os.environ.get("ROUNDCUBE_DB_FLAVOR", "sqlite") +if db_flavor == "sqlite": + os.environ["DB_DSNW"] = "sqlite:////data/roundcube.db" +elif db_flavor == "mysql": + os.environ["DB_DSNW"] = "mysql://%s:%s@%s/%s" % ( + os.environ.get("ROUNDCUBE_DB_USER", "roundcube"), os.environ.get("ROUNDCUBE_DB_PW"), - os.environ.get("ROUNDCUBE_DB_HOST",os.environ.get("DB_HOST","database")), - os.environ.get("ROUNDCUBE_DB_NAME","roundcube") - ) -elif db_flavor=="postgresql": - os.environ["DB_DSNW"]="pgsql://%s:%s@%s/%s" % ( - os.environ.get("ROUNDCUBE_DB_USER","roundcube"), + os.environ.get("ROUNDCUBE_DB_HOST", "database"), + os.environ.get("ROUNDCUBE_DB_NAME", "roundcube") + ) +elif db_flavor == "postgresql": + os.environ["DB_DSNW"] = "pgsql://%s:%s@%s/%s" % ( + os.environ.get("ROUNDCUBE_DB_USER", "roundcube"), os.environ.get("ROUNDCUBE_DB_PW"), - os.environ.get("ROUNDCUBE_DB_HOST",os.environ.get("DB_HOST","database")), - os.environ.get("ROUNDCUBE_DB_NAME","roundcube") - ) + os.environ.get("ROUNDCUBE_DB_HOST", "database"), + os.environ.get("ROUNDCUBE_DB_NAME", "roundcube") + ) else: - print("Unknown ROUNDCUBE_DB_FLAVOR: %s",db_flavor) + print("Unknown ROUNDCUBE_DB_FLAVOR: %s", db_flavor) exit(1) - - conf.jinja("/php.ini", os.environ, "/usr/local/etc/php/conf.d/roundcube.ini") # Create dirs, setup permissions @@ -42,7 +40,8 @@ try: print("Initializing database") - result=subprocess.check_output(["/var/www/html/bin/initdb.sh","--dir","/var/www/html/SQL"],stderr=subprocess.STDOUT) + result = subprocess.check_output(["/var/www/html/bin/initdb.sh", "--dir", "/var/www/html/SQL"], + stderr=subprocess.STDOUT) print(result.decode()) except subprocess.CalledProcessError as e: if "already exists" in e.stdout.decode(): @@ -53,7 +52,7 @@ try: print("Upgrading database") - subprocess.check_call(["/var/www/html/bin/update.sh","--version=?","-y"],stderr=subprocess.STDOUT) + subprocess.check_call(["/var/www/html/bin/update.sh", "--version=?", "-y"], stderr=subprocess.STDOUT) except subprocess.CalledProcessError as e: quit(1) @@ -61,7 +60,7 @@ os.system("chown -R www-data:www-data /data") # Tail roundcube logs -subprocess.Popen(["tail","-f","-n","0","/var/www/html/logs/errors.log"]) +subprocess.Popen(["tail", "-f", "-n", "0", "/var/www/html/logs/errors.log"]) # Run apache os.execv("/usr/local/bin/apache2-foreground", ["apache2-foreground"])
master version postgresql database roundcube webmail 502 Bad Gateway setup.mailu.io Version master Both postgresql and mysql are 502 Bad Gateway sqllite can open roundcube webmail Ranloop can work normally
I can confirm. The problem is here: https://github.com/Mailu/Mailu/blob/master/webmails/roundcube/start.py#L13-L28 We use the same `DB_HOST` and `DB_FLAVOR` as set by https://setup.mailu.io in `mailu.env` but don't also use `DB_USER`, `DB_PW` and `DB_NAME` โ€ฆ --- We are very sorry for the inconvenience, and will implement a fix for this. In the meantime as a workaround you can: a) set `ROUNDCUBE_DB_USER`, `ROUNDCUBE_DB_PW` and `ROUNDCUBE_DB_NAME` in your `mailu.env` to the same as the corresponding variables without `ROUNDCUBE_` โ€“ roundcube will then use your external DB with the correct credentials or b) set `ROUNDCUBE_DB_FLAVOR=sqlite` โ€“ roundcube will then use a separate sqlite file in `$YOUR_MAILU_TOPDIR/webmail/roundcube.db` Related issue: #1471 I have changed to sqlite, thanks Hi, Iโ€™m wondering what the right thing to do here is. Assuming the user has a external database, our docs instruct the user to create a `mailu` user and `mailu` database. Roundcube is currently geared to want its own database. So either, we leave the user with the duty to create another database, with permissions to the same `mailu` user, or we include the `ROUNDCUBE_DB_` variables in setup, expose and document them. The third option is to let roundcubes database-init script shove its data into the `mailu` database โ€ฆ which would probably work, but is never guaranteed to not-clash some day in the future, so for me this is the least favorable option. Is there another way I overlooked? Also, while i recognize this is a problematic issue, given how much others are around, are we sure this is our last 1.8-rc blocker :sweat_smile: :sweat_drops: or would we rather also postpone it, like so many other issues โ€ฆ I mean, at least thereโ€™s a workaround nicely described thanks to @HorayNarea?
2021-06-18T22:42:58
Mailu/Mailu
1,843
Mailu__Mailu-1843
[ "1842" ]
7481a6d272c6c6e262bc196ae3d762a5c9a014c5
diff --git a/core/admin/mailu/models.py b/core/admin/mailu/models.py --- a/core/admin/mailu/models.py +++ b/core/admin/mailu/models.py @@ -628,10 +628,10 @@ def resolve(cls, localpart, domain_name): sqlalchemy.and_(cls.domain_name == domain_name, sqlalchemy.or_( sqlalchemy.and_( - cls.wildcard is False, + cls.wildcard == False, cls.localpart == localpart ), sqlalchemy.and_( - cls.wildcard is True, + cls.wildcard == True, sqlalchemy.bindparam('l', localpart).like(cls.localpart) ) ) @@ -643,10 +643,10 @@ def resolve(cls, localpart, domain_name): sqlalchemy.and_(cls.domain_name == domain_name, sqlalchemy.or_( sqlalchemy.and_( - cls.wildcard is False, + cls.wildcard == False, sqlalchemy.func.lower(cls.localpart) == localpart_lower ), sqlalchemy.and_( - cls.wildcard is True, + cls.wildcard == True, sqlalchemy.bindparam('l', localpart_lower).like( sqlalchemy.func.lower(cls.localpart)) ) diff --git a/core/admin/mailu/schemas.py b/core/admin/mailu/schemas.py --- a/core/admin/mailu/schemas.py +++ b/core/admin/mailu/schemas.py @@ -590,7 +590,7 @@ def _deserialize(self, value, attr, data, **kwargs): value = value[:pos] else: footer = '-----END PRIVATE KEY-----' - except ValueError: + except ValueError as exc: raise ValidationError(f'invalid dkim key {bad_key!r}') from exc # remove whitespace from key data
Cannot receive email on aliases anymore. ## Environment & Versions ### Environment - [X] docker-compose ### Versions master ## Description Email sent to aliases serviced by Mailu are rejected. `550 5.1.1 <[email protected]>: Recipient address rejected: User unknown in virtual mailbox table` All aliases are still present in the admin panel. ## Replication Steps Deploy current master, send email to alias. ## Expected behaviour Email is accepted and delivered to mailbox. ## Logs ``` smtp_1 | Jul 03 00:47:21 hostname postfix/smtpd[392]: NOQUEUE: reject: RCPT from mail-wm1-x334.google.com[2a00:1450:4864:20::334]: 550 5.1.1 <[email protected]>: Recipient address rejected: User unknown in virtual mailbox table; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<mail-wm1-x334.google.com> ```
I can confirm this, the same issue is happening on my instance. The culprit seems to be this commit: https://github.com/Mailu/Mailu/commit/c24bff1c1be3980892fddb13a139b8142bb71f96 This line, and the three others regarding `cls.wildcard` (L634, L646, L649) were changed from `==` to `is`: https://github.com/Mailu/Mailu/blob/master/core/admin/mailu/models.py#L631 Changing it back to `==` fixes the issue. Can confirm building `admin` with those lines changed back to `==` fixes the problem.
2021-07-03T09:42:02
Mailu/Mailu
1,862
Mailu__Mailu-1862
[ "1861", "1861" ]
66ea28b50adce1c589fd6b2dc1b34356d4c64930
diff --git a/core/admin/mailu/internal/views/auth.py b/core/admin/mailu/internal/views/auth.py --- a/core/admin/mailu/internal/views/auth.py +++ b/core/admin/mailu/internal/views/auth.py @@ -63,7 +63,7 @@ def basic_authentication(): authorization = flask.request.headers.get("Authorization") if authorization and authorization.startswith("Basic "): encoded = authorization.replace("Basic ", "") - user_email, password = base64.b64decode(encoded).split(b":") + user_email, password = base64.b64decode(encoded).split(b":", 1) user = models.User.query.get(user_email.decode("utf8")) if nginx.check_credentials(user, password.decode('utf-8'), flask.request.remote_addr, "web"): response = flask.Response()
Radicale password check fails (length limited?) So far, the webdav radicale is protected with basic auth (apparently htaccess or similar). If user password > 8 then it fails to connect. we should remove this limitation to let use stong passwords Radicale password check fails (length limited?) So far, the webdav radicale is protected with basic auth (apparently htaccess or similar). If user password > 8 then it fails to connect. we should remove this limitation to let use stong passwords
As far as I know, it's handled in https://github.com/Mailu/Mailu/blob/66ea28b50adce1c589fd6b2dc1b34356d4c64930/core/admin/mailu/internal/views/auth.py#L60 and there is no length limit. Which version have you tested with? What's in master? Is there anything logged in the admin container? I have fixed a bug whereby tokens (that are longer) weren't considered... but that was not length related I think we should update the basic_authentication method. The handling of the base64 encoded data IMHO is a little bit sloppy. @parisni do you have a colon in the password? I think the split in line 66 will fail if there is any (", 1" missing). The username must not contain a colon, so it should be .split(b':', 1) @ghostwheel42 good catch! Yeah, I've checked the RFC and the username can't have a colon... maybe we should enforce that elsewhere too. @nextgens > maybe we should enforce that elsewhere too. There user name is a E-Mail address. The domain part is "checked" in the model: AFAIK idna encode does not encode a colon. I don't see a check for the local part, but this is part of my config-import/export/schema/api work in progress: I'll add validators to the model. As far as I know, it's handled in https://github.com/Mailu/Mailu/blob/66ea28b50adce1c589fd6b2dc1b34356d4c64930/core/admin/mailu/internal/views/auth.py#L60 and there is no length limit. Which version have you tested with? What's in master? Is there anything logged in the admin container? I have fixed a bug whereby tokens (that are longer) weren't considered... but that was not length related I think we should update the basic_authentication method. The handling of the base64 encoded data IMHO is a little bit sloppy. @parisni do you have a colon in the password? I think the split in line 66 will fail if there is any (", 1" missing). The username must not contain a colon, so it should be .split(b':', 1) @ghostwheel42 good catch! Yeah, I've checked the RFC and the username can't have a colon... maybe we should enforce that elsewhere too. @nextgens > maybe we should enforce that elsewhere too. There user name is a E-Mail address. The domain part is "checked" in the model: AFAIK idna encode does not encode a colon. I don't see a check for the local part, but this is part of my config-import/export/schema/api work in progress: I'll add validators to the model.
2021-07-14T07:30:07
Mailu/Mailu
1,863
Mailu__Mailu-1863
[ "1861" ]
14792384987a53a5373d65cd3fd021db563d325d
diff --git a/core/admin/mailu/internal/views/auth.py b/core/admin/mailu/internal/views/auth.py --- a/core/admin/mailu/internal/views/auth.py +++ b/core/admin/mailu/internal/views/auth.py @@ -51,7 +51,7 @@ def basic_authentication(): authorization = flask.request.headers.get("Authorization") if authorization and authorization.startswith("Basic "): encoded = authorization.replace("Basic ", "") - user_email, password = base64.b64decode(encoded).split(b":") + user_email, password = base64.b64decode(encoded).split(b":", 1) user = models.User.query.get(user_email.decode("utf8")) if user and user.enabled and user.check_password(password.decode("utf8")): response = flask.Response()
Radicale password check fails (length limited?) So far, the webdav radicale is protected with basic auth (apparently htaccess or similar). If user password > 8 then it fails to connect. we should remove this limitation to let use stong passwords
As far as I know, it's handled in https://github.com/Mailu/Mailu/blob/66ea28b50adce1c589fd6b2dc1b34356d4c64930/core/admin/mailu/internal/views/auth.py#L60 and there is no length limit. Which version have you tested with? What's in master? Is there anything logged in the admin container? I have fixed a bug whereby tokens (that are longer) weren't considered... but that was not length related I think we should update the basic_authentication method. The handling of the base64 encoded data IMHO is a little bit sloppy. @parisni do you have a colon in the password? I think the split in line 66 will fail if there is any (", 1" missing). The username must not contain a colon, so it should be .split(b':', 1) @ghostwheel42 good catch! Yeah, I've checked the RFC and the username can't have a colon... maybe we should enforce that elsewhere too. @nextgens > maybe we should enforce that elsewhere too. There user name is a E-Mail address. The domain part is "checked" in the model: AFAIK idna encode does not encode a colon. I don't see a check for the local part, but this is part of my config-import/export/schema/api work in progress: I'll add validators to the model.
2021-07-14T07:54:45
Mailu/Mailu
1,871
Mailu__Mailu-1871
[ "1448" ]
c5ff72d6574e6a0fefcededc70cd05ebb4966ff6
diff --git a/core/postfix/start.py b/core/postfix/start.py --- a/core/postfix/start.py +++ b/core/postfix/start.py @@ -36,6 +36,11 @@ def is_valid_postconf_line(line): os.environ["ADMIN_ADDRESS"] = system.get_host_address_from_environment("ADMIN", "admin") os.environ["ANTISPAM_MILTER_ADDRESS"] = system.get_host_address_from_environment("ANTISPAM_MILTER", "antispam:11332") os.environ["LMTP_ADDRESS"] = system.get_host_address_from_environment("LMTP", "imap:2525") +os.environ["OUTCLEAN"] = os.environ["HOSTNAMES"].split(",")[0] +try: + os.environ["OUTCLEAN_ADDRESS"] = system.resolve_hostname(os.environ["OUTCLEAN"]) +except: + os.environ["OUTCLEAN_ADDRESS"] = "10.10.10.10" for postfix_file in glob.glob("/conf/*.cf"): conf.jinja(postfix_file, os.environ, os.path.join("/etc/postfix", os.path.basename(postfix_file)))
Override to use server hostname + IP in outbound headers ## What type of PR? Enhancement ## What does this PR do? Allows users to set the server IP and hostname in the outgoing "Received" header rather than "PUBLIC_HOSTNAME [PUBLIC_IP]". ### Related issue(s) https://github.com/Mailu/Mailu/issues/191 ## Prerequistes Before we can consider review and merge, please make sure the following list is done and checked. If an entry in not applicable, you can check it or remove it from the list. - [x] In case of feature or enhancement: documentation updated accordingly - [ ] Unless it's docs or a minor change: add [changelog](https://mailu.io/master/contributors/guide.html#changelog) entry file.
Thanks for submitting this pull request. Bors-ng will now build test images. When it succeeds, we will continue to review and test your PR. bors try Note: if this build fails, [read this](http://mailu.io/master/contributors/environment.html#when-bors-try-fails). ## try Build succeeded: * [continuous-integration/travis-ci/push](https://travis-ci.org/github/Mailu/Mailu/builds/674816408?utm_source=github_status&utm_medium=notification) Does it make sense to generally use something like `os.environ["HOSTNAMES"].split(",")[0]` + 127.0.0.1/0.0.0.0/..? For example Exchange Online also seems to just write the server handling the connection instead of the client into the header: ``` Received: from AM0PR05MB4452.eurprd05.prod.outlook.com ([fe80::51ec:24fe:245c:527e]) by AM0PR05MB4452.eurprd05.prod.outlook.com ([fe80::51ec:24fe:245c:527e%7]) with mapi id 15.20.3391.014; Wed, 16 Sep 2020 08:08:02 +0000 ``` The server information is public anyway and it's probably better than a generic placeholder. I agree; I think it would make sense to avoid a new configuration flag... and to turn it on by default with a fallback to 127.0.0.1 if the address lookup fails. @dmwilcox are you still okay to work on this? Looking forward to see this feature ;)
2021-07-18T16:30:14
Mailu/Mailu
1,874
Mailu__Mailu-1874
[ "1869" ]
c5ff72d6574e6a0fefcededc70cd05ebb4966ff6
diff --git a/setup/server.py b/setup/server.py --- a/setup/server.py +++ b/setup/server.py @@ -54,11 +54,11 @@ def build_app(path): @app.context_processor def app_context(): return dict( - versions=os.getenv("VERSIONS","master").split(','), + versions=os.getenv("VERSIONS","master").split(','), stable_version = os.getenv("stable_version", "master") ) - prefix_bp = flask.Blueprint(version, __name__) + prefix_bp = flask.Blueprint(version.replace(".", "_"), __name__) prefix_bp.jinja_loader = jinja2.ChoiceLoader([ jinja2.FileSystemLoader(os.path.join(path, "templates")), jinja2.FileSystemLoader(os.path.join(path, "flavors"))
Weblate instance is down I tried accessing the Weblate instance and potentially add another language but it looks down.
2021-07-20T11:43:28
Mailu/Mailu
1,885
Mailu__Mailu-1885
[ "1884" ]
56a6821875a2742e18e087e681b97f6820edde9a
diff --git a/core/postfix/start.py b/core/postfix/start.py --- a/core/postfix/start.py +++ b/core/postfix/start.py @@ -38,7 +38,11 @@ def is_valid_postconf_line(line): os.environ["LMTP_ADDRESS"] = system.get_host_address_from_environment("LMTP", "imap:2525") os.environ["OUTCLEAN"] = os.environ["HOSTNAMES"].split(",")[0] try: - os.environ["OUTCLEAN_ADDRESS"] = system.resolve_hostname(os.environ["OUTCLEAN"]) + _to_lookup = os.environ["OUTCLEAN"] + # Ensure we lookup a FQDN: @see #1884 + if not _to_lookup.endswith('.'): + _to_lookup += '.' + os.environ["OUTCLEAN_ADDRESS"] = system.resolve_hostname(_to_lookup) except: os.environ["OUTCLEAN_ADDRESS"] = "10.10.10.10"
Postfix no longer starts correctly in kubernetes ## Environment & Versions ### Environment - [ ] docker-compose - [X] kubernetes - [ ] docker swarm ### Versions 1.8 ## Description After installing mailu 1.8 via helm on Kubernetes, the `mailu-postfix` container runs but never reaches a healthy state and smtp functionality is impaired. After digging into it I believe the container is failing to become healthy because the following change to the postfix container's startup script (https://github.com/Mailu/Mailu/commit/1d65529c94f54de3cb49ed9584ed95f7860c26fa) and a known issue with the musl resolver the alpine base image uses (https://github.com/kubernetes/kubernetes/issues/64924). Resolving the mailu installation hostname never succeeds because of the aforementioned bug, and `socrates.system.resolve_hostname` simply retries until the pod's failure threshold is exceeded and is restarted. There's a couple different ways I believe this could be resolved: 1. Pass a FQDN to `system.resolve_hostname()`, which avoids the resolver bug with search lists, i.e. `domain.com.` with a trailing dot. 2. Update the deployment manifest in the mailu helm chart to use `dnsConfig.options` on the pod spec to set a more agreeable `ndots` value for `/etc/resolv.conf` 3. Use a different base image for mailu containers that is not affected by this issue. I would be happy to investigate further and file a PR with the appropriate changes based on feedback. Thanks!
2021-07-24T10:44:01
Mailu/Mailu
1,886
Mailu__Mailu-1886
[ "1294" ]
56a6821875a2742e18e087e681b97f6820edde9a
diff --git a/core/postfix/start.py b/core/postfix/start.py --- a/core/postfix/start.py +++ b/core/postfix/start.py @@ -8,12 +8,13 @@ import sys from podop import run_server +from pwd import getpwnam from socrate import system, conf log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", "WARNING")) def start_podop(): - os.setuid(100) + os.setuid(getpwnam('postfix').pw_uid) url = "http://" + os.environ["ADMIN_ADDRESS"] + "/internal/postfix/" # TODO: Remove verbosity setting from Podop? run_server(0, "postfix", "/tmp/podop.socket", [
connect to /tmp/podop.socket: Permission denied Hi, I build the docker images from Mailu/tests/build_arm.sh (commit 5d20f28). Setting mailu.env log level to: `LOG_LEVEL=DEBUG` I got this "Temporary lookup failure" when sending a test email to my domain. Digging out the postfix's log is the best I can manage with my limited knowledge. Any help please? Thanks, Tin. `smtp | Dec 25 21:35:01 mail postfix/trivial-rewrite[276]: warning: connect to /tmp/podop.socket: Permission denied` `smtp | Dec 25 21:35:01 mail postfix/trivial-rewrite[276]: warning: table socketmap:unix:/tmp/podop.socket:transport lookup error: Permission denied` `smtp | Dec 25 21:35:01 mail postfix/trivial-rewrite[276]: warning: socketmap:unix:/tmp/podop.socket:transport lookup error for "*"` `smtp | Dec 25 21:35:01 mail postfix/trivial-rewrite[276]: warning: connect to /tmp/podop.socket: Permission denied` `smtp | Dec 25 21:35:01 mail postfix/trivial-rewrite[276]: warning: table socketmap:unix:/tmp/podop.socket:transport lookup error: Permission denied` `smtp | Dec 25 21:35:01 mail postfix/trivial-rewrite[276]: warning: socketmap:unix:/tmp/podop.socket:transport lookup error for "*"` `smtp | Dec 25 21:35:01 mail postfix/trivial-rewrite[276]: warning: connect to /tmp/podop.socket: Permission denied` `smtp | Dec 25 21:35:01 mail postfix/trivial-rewrite[276]: warning: table socketmap:unix:/tmp/podop.socket:domain lookup error: Permission denied` `smtp | Dec 25 21:35:01 mail postfix/trivial-rewrite[276]: warning: virtual_mailbox_domains: socketmap:unix:/tmp/podop.socket:domain: table lookup problem` `smtp | Dec 25 21:35:01 mail postfix/trivial-rewrite[276]: warning: virtual_mailbox_domains lookup failure` `smtp | Dec 25 21:35:19 mail postfix/trivial-rewrite[276]: warning: connect to /tmp/podop.socket: Permission denied` `smtp | Dec 25 21:35:19 mail postfix/trivial-rewrite[276]: warning: table socketmap:unix:/tmp/podop.socket:domain lookup error: Permission denied` `smtp | Dec 25 21:35:19 mail postfix/trivial-rewrite[276]: warning: virtual_mailbox_domains: socketmap:unix:/tmp/podop.socket:domain: table lookup problem` `smtp | Dec 25 21:35:19 mail postfix/trivial-rewrite[276]: warning: virtual_mailbox_domains lookup failure` `smtp | Dec 25 21:35:19 mail postfix/smtpd[198]: NOQUEUE: reject: RCPT from localhost[127.0.0.1]: 451 4.3.0 <tin@***obscured.com***>: Temporary lookup failure; from=<admin@***obscured.com***> to=<tin@***obscured.com***> proto=SMTP helo=<mail.***obscured.com***>` `smtp | Dec 25 21:35:24 mail postfix/smtpd[258]: connect from localhost[127.0.0.1]` `smtp | Dec 25 21:35:24 mail postfix/smtpd[258]: disconnect from localhost[127.0.0.1] quit=1 commands=1`
Looks like the Podop socket that is either not open or does not have the proper mode. Could you enter the container and get us the output of `ls -la /tmp`, plus `ps faux`? Thanks for the comment @kaiyou. Please see below. `bash-5.0# ls -la /tmp/` ``` total 8 drwxrwxrwt 1 root root 4096 Jan 11 10:02 . drwxr-xr-x 1 root root 4096 Jan 11 10:02 .. srwxr-xr-x 1 messageb root 0 Jan 11 10:02 podop.socket ``` `bash-5.0# ps faux` ``` PID USER TIME COMMAND 1 root 0:01 {start.py} /usr/bin/python3 /start.py 14 messageb 0:00 {start.py} /usr/bin/python3 /start.py 111 root 0:00 {postfix-script} /bin/sh /usr/libexec/postfix/postfix-script start-fg 178 root 0:00 /usr/libexec/postfix/master -s 179 postfix 0:00 pickup -l -t unix -u 180 postfix 0:00 qmgr -l -t unix -u 181 postfix 0:00 postlogd -l -n postlog -t unix-dgram -u 191 postfix 0:00 smtpd -n smtp -t inet -u -o stress= -s 2 533 root 0:00 bash 539 root 0:00 ps faux ``` I went ahead and did: `chmod a+rwx /tmp/podop.socket` And now I can both receive and send emails. Could you please let me know the correct permissions? Thanks, Tin. It should be owned by postfix, not this messageb user. Could you run `getent passwd` in the container? Maybe the 100 uid changed recently. Which would lead to this catastrophe. Here you go. I included everything for completeness: ``` bash-5.0# getent passwd root:x:0:0:root:/root:/bin/ash bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin adm:x:3:4:adm:/var/adm:/sbin/nologin lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin sync:x:5:0:sync:/sbin:/bin/sync shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown halt:x:7:0:halt:/sbin:/sbin/halt mail:x:8:12:mail:/var/spool/mail:/sbin/nologin news:x:9:13:news:/usr/lib/news:/sbin/nologin uucp:x:10:14:uucp:/var/spool/uucppublic:/sbin/nologin operator:x:11:0:operator:/root:/sbin/nologin man:x:13:15:man:/usr/man:/sbin/nologin postmaster:x:14:12:postmaster:/var/spool/mail:/sbin/nologin cron:x:16:16:cron:/var/spool/cron:/sbin/nologin ftp:x:21:21::/var/lib/ftp:/sbin/nologin sshd:x:22:22:sshd:/dev/null:/sbin/nologin at:x:25:25:at:/var/spool/cron/atjobs:/sbin/nologin squid:x:31:31:Squid:/var/cache/squid:/sbin/nologin xfs:x:33:33:X Font Server:/etc/X11/fs:/sbin/nologin games:x:35:35:games:/usr/games:/sbin/nologin postgres:x:70:70::/var/lib/postgresql:/bin/sh cyrus:x:85:12::/usr/cyrus:/sbin/nologin vpopmail:x:89:89::/var/vpopmail:/sbin/nologin ntp:x:123:123:NTP:/var/empty:/sbin/nologin smmsp:x:209:209:smmsp:/var/spool/mqueue:/sbin/nologin guest:x:405:100:guest:/dev/null:/sbin/nologin nobody:x:65534:65534:nobody:/:/sbin/nologin messagebus:x:100:101:messagebus:/dev/null:/sbin/nologin postfix:x:101:102:postfix:/var/spool/postfix:/sbin/nologin vmail:x:102:103:vmail:/var/mail/domains:/sbin/nologin ``` Oh dear this sounds bad. Which version of Mailu are you running? I will try to replicate this locally. Possibly this is due to the base arm image which has a messagebus user that occupies uid 100. Yes, my arch is ARMv7. I don't remember why I did, but I git clone and build the images locally. See git history below. `[bash]$ git log --pretty -p -1` ``` commit 5d20f2893aaa8b25a429ed2b895dee599c6f0de1 (HEAD -> master, origin/staging, origin/master, origin/HEAD) Merge: 2b50333 0281205 Author: bors[bot] <26634292+bors[bot]@users.noreply.github.com> Date: Tue Dec 24 08:33:46 2019 +0000 Merge #1291 1291: Upgrade alpine to get new clamav. r=mergify[bot] a=youngnicks ## What type of PR? bug-fix ## What does this PR do? Upgrades alpine version to get new clamav. Also upgrades clamav config to latest variable names. ### Related issue(s) - Auto close an issue like: closes #1290 Co-authored-by: Nick Young <[email protected]> ``` That must be an issue with the different base image that installs a packages which reserves the postfix uid We might switch image. In the meantime you could replace the uid 100 by uid 101 in the postfix start script. **cc** @abondis Maybe you have some insights (or know a better base image), since you did the ARM stuff? unfortunately I don't have a better image. But I wonder, why is the script using a static UID? wouldn't there be a way to parametrize it? or use the username instead of the ID? I do not think username is supported, but we could resolve it at startup. @kaiyou currently official `alpine` baseimage supports ARM architecture. I've built Mailu directly on ARM machine without build_arm.sh script and it works @dmirubtsov , I did something naughty. I pulled the latest git: ``` [bash]$ git log --pretty -p -1 commit 0bc10b7bc5b473b8b5f5c3286ba0b73f51fbc3ab (HEAD -> master, origin/staging, origin/master, origin/HEAD) Merge: 9db7095 ae6f829 Author: bors[bot] <26634292+bors[bot]@users.noreply.github.com> Date: Wed Jan 29 18:59:50 2020 +0000 Merge #1269 1269: Add Fail2Ban section r=hoellen a=iohenkies ## What type of PR? documentation ## What does this PR do? This PR adds documentation to setup Fail2Ban to secure Mailu. ### Related issue(s) - closes #1263 ## Prerequistes Before we can consider review and merge, please make sure the following list is done and checked. If an entry in not applicable, you can check it or remove it from the list. - [x] In case of feature or enhancement: documentation updated accordingly - [x] Unless it's docs or a minor change: add [changelog](https://mailu.io/master/contributors/guide.html#changelog) entry file. edit [@hoellen]: Give information about the PR and link issue. Co-authored-by: iohenkies <[email protected]> ``` and do a "docker-compose build" from the file "https://github.com/Mailu/Mailu/blob/master/tests/build.yml" file. Running the container, and smtp server is met with an error: `postsuper: fatal: scan_dir_push: open directory defer: Permission denied` @kaiyou , on the same latest commit above. I ran "https://github.com/Mailu/Mailu/blob/master/tests/build_arm.sh". Running the containers with the new images, I can send and receive emails without no errors. No changes in socket permissions when I re-inspect them in the smtp container: ``` bash-5.0# getent passwd ..... messagebus:x:100:101:messagebus:/dev/null:/sbin/nologin postfix:x:101:102:postfix:/var/spool/postfix:/sbin/nologin vmail:x:102:103:vmail:/var/mail/domains:/sbin/nologin bash-5.0# ls /tmp/ -la total 8 drwxrwxrwt 1 root root 4096 Jan 30 00:32 . drwxr-xr-x 1 root root 4096 Jan 30 00:32 .. srwxrwxrwx 1 messageb root 0 Jan 30 00:32 podop.socket ``` What do you think? @dmirubtsov maybe we can get rid of some of the specifics of the arm build then, but I do not know how to build these on Travis. @Tin-Bui I do not understand the issue in your last comment, could you elaborate ? > currently official `alpine` baseimage supports ARM architecture. I've built Mailu directly on ARM machine without build_arm.sh script and it works @dmirubtsov : the script was not meant to build for arm directly on arm, I don't know if it should work ... the purpose was to build the ARM images from a non-ARM platform (ie: powerful desktop vs doing it from a raspberry pi), that means using (or preparing) an image that has the `qemu-arm-static` binary (likeso https://ownyourbits.com/2018/06/27/running-and-building-arm-docker-containers-in-x86/) > I do not know how to build these on Travis. @kaiyou : is there no way to make travis run the script? It's been a while since I did it, but I think `docker run --rm --privileged multiarch/qemu-user-static:register` in the script makes it so the host doesn't need to have said binary locally. @kaiyou https://github.com/Mailu/Mailu/issues/1294#issuecomment-580118006 I no longer have the original issue with permissions when sending and receiving emails. No change to the original root cause (podop.socket permissions + users ID stay the same), but I no longer experience the symptom. Probably a good thing? Hi all, I ran exactly in the same issue with the latest version of Mailu built with build_arm.sh. uid 100 is messagebus... using a version of May 6... ``` /hdd/dev/docker/Mailu.orig $ git log --pretty -p -1 commit d00ccc16d7d51be87daf761d7889ffa8cf059f23 (HEAD -> master, origin/staging, origin/master, origin/HEAD) Merge: 535562e 455814d Author: bors[bot] <26634292+bors[bot]@users.noreply.github.com> Date: Wed May 6 05:39:39 2020 +0000 Merge #1487 1487: Fix postfix queue permissions r=mergify[bot] a=ofthesun9 ## What type of PR? bug-fix (by anticipation of a potential change in base image) ## What does this PR do? We need to check /queue permissions before starting postfix. In case of postfix/postdrop uid/gid change, postfix would fail to start ### Related issue(s) closes #1486 ## Prerequistes - [x] In case of feature or enhancement: documentation updated accordingly Co-authored-by: ofthesun9 <[email protected]> ``` Did a chown postfix /tmp/podo.socket and all went good then... I'll try building directly w/o the build_arm.sh script but I'm not sure why it would change anything: at the end, I will use the same alpine package, won't I? It is weird indeed. I played a bit around the armbuild and never cross this issue, but I was building for arm64 not armhf... I was unable to have antispam running on alpine:3.10 nor alpine:3.11 (SIGILL at startup), So I finally switched all the images to debian ;-) If your platform can run arm64, and are willing to give it a try: my repo is ofthesun9 and the branch is test-debian-multiarch, or if you have a docker-compose.yml built from setup.mailu.io: > docker-compose down > DOCKER_ORG=ofthesun9 MAILU_VERSION=test-debian-multiarch docker-compose up -d Hi @ofthesun9, thanks I just finished building the "standard" one (i.e. w/o the build_arm.sh script). I'll try it first and if it doesn't work, I'll give a try to yours and let you know. As I am running a pi4, it can run arm64, I assume... I had a look on the build_arm.sh script: DISTRO is set to "balenalib/rpi-alpine:$ALPINE_VER" I assume that balenalib/rpi-alpine is having an extra package already installed and taking the UID 100 before postfix get installed... I built the standard version (with alpine 3.10.5) and everything seems to be working fine (including rspamd which is healthy)... Also, postfix uid is 100 and there is no messagebus user, so you're right @ofthesun9: I looked at the Docker file of rpi-alpine and it installs: apk add --no-cache bash ca-certificates curl dbus findutils tar udev gnupg And dbus probably creates the messagebus user... It means that it not safe at all to rely on an uid to build Mailu... Maybe I'll push the mailu images for RPi on dockerhub later if my tests are ok... @ofthesun9 I am currently pushing my images to dockerhub if you want to give it a try : DOCKER_ORG='leolivier' DOCKER_PREFIX='mailu_' MAILU_VERSION='rpi-armv7' docker-compose up -d One thing I noticed compared to your Debian images is that mine (Alpine based) are much smaller (e.g. 30.13MB for mailu_postfix for me compared to 61.91MB - compressed - for your image tagged arm64-test-debian-multiarch) Chiming in here as I hit the same issue (apparently because I built the ARM image on an ARM device). Running this in the mailu directory (`/mailu` by default) did the trick for me: `docker exec -it mailu_smtp_1 chown postfix /tmp/podop.socket` Side note - I actually originally ran the build on a much more equipped laptop, but the docs were a bit lite - following https://mailu.io/master/rpi_build.html I ran `./deploy_to_pi.sh` and got an empty zip. Frustration drove me to build directly on the pi... Would love it if we had dockerhub images available! If you are using an arm64 device, you can find images at #1421. If you are using an arm32 device, you have to generate your own build and follow tests/build_arm.sh Unfortunately, the use of balenalib/rpi-alpine as DISTRO is creating the podop.socket permission issue... the build_arm.sh script need an update ;-) Could you please try to compile (on your amd64 laptop) using: ``` docker run --rm --privileged multiarch/qemu-user-static --reset -p yes MAILU_VERSION=arm32v7_QEMU docker-compose -f tests/build.yml build --build-arg DISTRO=arm32v7/alpine:3.12 --build-arg ARCH=arm32v7/ ``` Then you will need to push those images to your own dockerhub registry, and pull them back on your ARM device. @fracture-point Not wanting to put myself in the spotlight :smile: but you can find on docker hub (leolivier) images for Mailu regularly updated (built on my Pi automatically every week for the core and monthly for the others) @ofthesun9, yes the standard alpine image works like a charm. Also I tried this weekend to change the Travis build to use the multiarch feature but unfortunately this works with arm64 but not arm32 :unamused: Thank you both @ofthesun9 & @leolivier - your dockhub images are just what I needed (and also resolved another tricky issue I was trying to track down). Hi There, The `Mailu`-Project is currently in a bit of a bind! We are short on man-power, and we need to judge if it is possible for us to put in some work on this issue. To help with that, we are currently trying to find out which issues are actively keeping users from using `Mailu`, which issues have someone who want to work on them โ€” and which issues may be less important. These a less important ones could be discarded for the time being, until the project is in a more stable and regular state once again. In order for us to better assess this, it would be helpful if you could put a **reaction on this post** (use the :smiley: icon to the top-right). - ๐Ÿ‘๏ธ if you **need this** to be able to use Mailu. Ideally, youโ€™d also be able to test this on your installation, and provide feedback โ€ฆ - ๐ŸŽ‰ if you find it a **nice bonus**, but no deal-breaker - ๐Ÿš€ if you want to **work on it yourself**! We want to keep this **voting open for 2 weeks** from now, so please help out! This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Hi There, we see this issue had only little attention ๐Ÿ˜Ÿ. As much as it pains us: In order to get the current issues a bit more manageable for us, we decided to close it. ๐Ÿ‘‹๐Ÿ‘‹ We hope that no one feels offended by doing so. Should the issue get really pressing in the future, please feel free to re-open it. Thank you for your patience and understanding, ๐Ÿ™‡ - Your Mailu Team This sounds like a real/current problem according to #1883
2021-07-24T12:42:21
Mailu/Mailu
1,890
Mailu__Mailu-1890
[ "1878" ]
f8db4a053131e5eb797358c82b837bd2c83027be
diff --git a/core/admin/mailu/models.py b/core/admin/mailu/models.py --- a/core/admin/mailu/models.py +++ b/core/admin/mailu/models.py @@ -371,8 +371,8 @@ def _update_domain_name(target, value, *_): @classmethod def __declare_last__(cls): # gets called after mappings are completed - sqlalchemy.event.listen(User.localpart, 'set', cls._update_localpart, propagate=True) - sqlalchemy.event.listen(User.domain_name, 'set', cls._update_domain_name, propagate=True) + sqlalchemy.event.listen(cls.localpart, 'set', cls._update_localpart, propagate=True) + sqlalchemy.event.listen(cls.domain_name, 'set', cls._update_domain_name, propagate=True) def sendmail(self, subject, body): """ send an email to the address """
Cannot create aliases anymore ## Environment & Versions ### Environment - docker-compose ### Versions master ## Description Clicking save on a new alias leads to an "Internal Server Error" page. ## Replication Steps Open the form to add a new alias to an email account, fill out the form, click save. ## Expected behaviour The alias is added normally. ## Logs ``` admin_1 | /usr/lib/python3.8/site-packages/sqlalchemy/sql/crud.py:799: SAWarning: Column 'alias.email' is marked as a member of the prima[15/984] or table 'alias', but has no Python-side or server-side default generator indicated, nor does it indicate 'autoincrement=True' or 'nullable=True', and no explicit value is passed. Primary key columns typically may not store NULL. admin_1 | util.warn(msg) admin_1 | [2021-07-21 14:43:14,316] ERROR in app: Exception on /ui/alias/create/***.** [POST] admin_1 | Traceback (most recent call last): admin_1 | File "/usr/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1243, in _execute_context admin_1 | self.dialect.do_execute( admin_1 | File "/usr/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 552, in do_execute admin_1 | cursor.execute(statement, parameters) admin_1 | sqlite3.IntegrityError: NOT NULL constraint failed: alias.email admin_1 | admin_1 | The above exception was the direct cause of the following exception: admin_1 | admin_1 | Traceback (most recent call last): admin_1 | File "/usr/lib/python3.8/site-packages/flask/app.py", line 2292, in wsgi_app admin_1 | response = self.full_dispatch_request() admin_1 | File "/usr/lib/python3.8/site-packages/flask/app.py", line 1815, in full_dispatch_request admin_1 | rv = self.handle_user_exception(e) admin_1 | File "/usr/lib/python3.8/site-packages/flask/app.py", line 1718, in handle_user_exception admin_1 | reraise(exc_type, exc_value, tb) admin_1 | File "/usr/lib/python3.8/site-packages/flask/_compat.py", line 35, in reraise admin_1 | raise value admin_1 | File "/usr/lib/python3.8/site-packages/flask/app.py", line 1813, in full_dispatch_request admin_1 | rv = self.dispatch_request() admin_1 | File "/usr/lib/python3.8/site-packages/flask/app.py", line 1799, in dispatch_request admin_1 | return self.view_functions[rule.endpoint](**req.view_args) admin_1 | File "/usr/lib/python3.8/site-packages/flask_login/utils.py", line 261, in decorated_view admin_1 | return func(*args, **kwargs) admin_1 | File "/app/mailu/ui/access.py", line 28, in wrapper admin_1 | return callback(function, args, kwargs, dargs, dkwargs) admin_1 | File "/app/mailu/ui/access.py", line 19, in callback admin_1 | return function(*args, **kwargs) admin_1 | File "/app/mailu/ui/views/aliases.py", line 31, in alias_create admin_1 | models.db.session.commit() admin_1 | File "/usr/lib/python3.8/site-packages/sqlalchemy/orm/scoping.py", line 162, in do admin_1 | return getattr(self.registry(), name)(*args, **kwargs) admin_1 | File "/usr/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1026, in commit admin_1 | self.transaction.commit() admin_1 | File "/usr/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 493, in commit admin_1 | self._prepare_impl() admin_1 | File "/usr/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 472, in _prepare_impl admin_1 | self.session.flush() admin_1 | File "/usr/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 2451, in flush admin_1 | self._flush(objects) admin_1 | File "/usr/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 2589, in _flush admin_1 | transaction.rollback(_capture_exception=True) admin_1 | File "/usr/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py", line 68, in __exit__ admin_1 | compat.reraise(exc_type, exc_value, exc_tb) admin_1 | File "/usr/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 129, in reraise admin_1 | raise value admin_1 | File "/usr/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 2549, in _flush admin_1 | flush_context.execute() admin_1 | File "/usr/lib/python3.8/site-packages/sqlalchemy/orm/unitofwork.py", line 422, in execute admin_1 | rec.execute(self) admin_1 | File "/usr/lib/python3.8/site-packages/sqlalchemy/orm/unitofwork.py", line 586, in execute admin_1 | persistence.save_obj( admin_1 | File "/usr/lib/python3.8/site-packages/sqlalchemy/orm/persistence.py", line 239, in save_obj admin_1 | _emit_insert_statements( admin_1 | File "/usr/lib/python3.8/site-packages/sqlalchemy/orm/persistence.py", line 1119, in _emit_insert_statements admin_1 | result = cached_connections[connection].execute( admin_1 | File "/usr/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 988, in execute admin_1 | return meth(self, multiparams, params) admin_1 | File "/usr/lib/python3.8/site-packages/sqlalchemy/sql/elements.py", line 287, in _execute_on_connection admin_1 | return connection._execute_clauseelement(self, multiparams, params) admin_1 | File "/usr/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1101, in _execute_clauseelement admin_1 | ret = self._execute_context( admin_1 | File "/usr/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1247, in _execute_context admin_1 | self._handle_dbapi_exception( admin_1 | File "/usr/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1466, in _handle_dbapi_exception admin_1 | util.raise_from_cause(sqlalchemy_exception, exc_info) admin_1 | File "/usr/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 383, in raise_from_cause admin_1 | reraise(type(exception), exception, tb=exc_tb, cause=cause) admin_1 | File "/usr/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 128, in reraise admin_1 | raise value.with_traceback(tb) admin_1 | File "/usr/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1243, in _execute_context admin_1 | self.dialect.do_execute( admin_1 | File "/usr/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 552, in do_execute admin_1 | cursor.execute(statement, parameters) admin_1 | sqlalchemy.exc.IntegrityError: (sqlite3.IntegrityError) NOT NULL constraint failed: alias.email admin_1 | [SQL: INSERT INTO alias (created_at, updated_at, comment, localpart, wildcard, destination, domain_name) VALUES (?, ?, ?, ?, ?, ?, ?)] admin_1 | [parameters: ('2021-07-21', None, '', 'newalias', 0, 'account@***.**', '***.**')] admin_1 | (Background on this error at: http://sqlalche.me/e/gkpj) ```
@cobrafast I encountered exactly the same problem when creating a new alias on `master`. You reported this 4 hours earlier independent from me: ``` mailu_admin | /usr/lib/python3.8/site-packages/sqlalchemy/sql/crud.py:799: SAWarning: Column 'alias.email' is marked as a member of the primary key for table 'alias', but has no Python-side or server-side default generator indicated, nor does it indicate 'autoincrement=True' or 'nullable=True', and no explicit value is passed. Primary key columns typically may not store NULL. mailu_admin | util.warn(msg) mailu_admin | [2021-07-21 19:07:35,443] ERROR in app: Exception on /ui/alias/create/mydomain.nl [POST] mailu_admin | Traceback (most recent call last): mailu_admin | File "/usr/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1243, in _execute_context mailu_admin | self.dialect.do_execute( mailu_admin | File "/usr/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 552, in do_execute mailu_admin | cursor.execute(statement, parameters) mailu_admin | sqlite3.IntegrityError: NOT NULL constraint failed: alias.email mailu_admin | mailu_admin | The above exception was the direct cause of the following exception: mailu_admin | mailu_admin | Traceback (most recent call last): mailu_admin | File "/usr/lib/python3.8/site-packages/flask/app.py", line 2292, in wsgi_app mailu_admin | response = self.full_dispatch_request() mailu_admin | File "/usr/lib/python3.8/site-packages/flask/app.py", line 1815, in full_dispatch_request mailu_admin | rv = self.handle_user_exception(e) mailu_admin | File "/usr/lib/python3.8/site-packages/flask/app.py", line 1718, in handle_user_exception mailu_admin | reraise(exc_type, exc_value, tb) mailu_admin | File "/usr/lib/python3.8/site-packages/flask/_compat.py", line 35, in reraise mailu_admin | raise value mailu_admin | File "/usr/lib/python3.8/site-packages/flask/app.py", line 1813, in full_dispatch_request mailu_admin | rv = self.dispatch_request() mailu_admin | File "/usr/lib/python3.8/site-packages/flask/app.py", line 1799, in dispatch_request mailu_admin | return self.view_functions[rule.endpoint](**req.view_args) mailu_admin | File "/usr/lib/python3.8/site-packages/flask_login/utils.py", line 261, in decorated_view mailu_admin | return func(*args, **kwargs) mailu_admin | File "/app/mailu/ui/access.py", line 28, in wrapper mailu_admin | return callback(function, args, kwargs, dargs, dkwargs) mailu_admin | File "/app/mailu/ui/access.py", line 19, in callback mailu_admin | return function(*args, **kwargs) mailu_admin | File "/app/mailu/ui/views/aliases.py", line 31, in alias_create mailu_admin | models.db.session.commit() mailu_admin | File "/usr/lib/python3.8/site-packages/sqlalchemy/orm/scoping.py", line 162, in do mailu_admin | return getattr(self.registry(), name)(*args, **kwargs) mailu_admin | File "/usr/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1026, in commit mailu_admin | self.transaction.commit() mailu_admin | File "/usr/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 493, in commit mailu_admin | self._prepare_impl() mailu_admin | File "/usr/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 472, in _prepare_impl mailu_admin | self.session.flush() mailu_admin | File "/usr/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 2451, in flush mailu_admin | self._flush(objects) mailu_admin | File "/usr/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 2589, in _flush mailu_admin | transaction.rollback(_capture_exception=True) mailu_admin | File "/usr/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py", line 68, in __exit__ mailu_admin | compat.reraise(exc_type, exc_value, exc_tb) mailu_admin | File "/usr/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 129, in reraise mailu_admin | raise value mailu_admin | File "/usr/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 2549, in _flush mailu_admin | flush_context.execute() mailu_admin | File "/usr/lib/python3.8/site-packages/sqlalchemy/orm/unitofwork.py", line 422, in execute mailu_admin | rec.execute(self) mailu_admin | File "/usr/lib/python3.8/site-packages/sqlalchemy/orm/unitofwork.py", line 586, in execute mailu_admin | persistence.save_obj( mailu_admin | File "/usr/lib/python3.8/site-packages/sqlalchemy/orm/persistence.py", line 239, in save_obj mailu_admin | _emit_insert_statements( mailu_admin | File "/usr/lib/python3.8/site-packages/sqlalchemy/orm/persistence.py", line 1119, in _emit_insert_statements mailu_admin | result = cached_connections[connection].execute( mailu_admin | File "/usr/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 988, in execute mailu_admin | return meth(self, multiparams, params) mailu_admin | File "/usr/lib/python3.8/site-packages/sqlalchemy/sql/elements.py", line 287, in _execute_on_connection mailu_admin | return connection._execute_clauseelement(self, multiparams, params) mailu_admin | File "/usr/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1101, in _execute_clauseelement mailu_admin | ret = self._execute_context( mailu_admin | File "/usr/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1247, in _execute_context mailu_admin | self._handle_dbapi_exception( mailu_admin | File "/usr/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1466, in _handle_dbapi_exception mailu_admin | util.raise_from_cause(sqlalchemy_exception, exc_info) mailu_admin | File "/usr/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 383, in raise_from_cause mailu_admin | reraise(type(exception), exception, tb=exc_tb, cause=cause) mailu_admin | File "/usr/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 128, in reraise mailu_admin | raise value.with_traceback(tb) mailu_admin | File "/usr/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1243, in _execute_context mailu_admin | self.dialect.do_execute( mailu_admin | File "/usr/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 552, in do_execute mailu_admin | cursor.execute(statement, parameters) mailu_admin | sqlalchemy.exc.IntegrityError: (sqlite3.IntegrityError) NOT NULL constraint failed: alias.email mailu_admin | [SQL: INSERT INTO alias (created_at, updated_at, comment, localpart, wildcard, destination, domain_name) VALUES (?, ?, ?, ?, ?, ?, ?)] mailu_admin | [parameters: ('2021-07-21', None, '', 'user', 0, '', 'mydomain.nl')] mailu_admin | (Background on this error at: http://sqlalche.me/e/gkpj) ``` ```bash $ git log commit 0031f262cc7c8351687d12dc04a0c0d80183d6ac (HEAD -> master, origin/master, origin/HEAD) Merge: d010f1d3 1d65529c Author: bors[bot] <26634292+bors[bot]@users.noreply.github.com> Date: Tue Jul 20 12:13:19 2021 +0000 ``` Any ideas? Issue is reproducible with latest `master` and empty Docker volume: * Ubuntu desktop 21.04 AMD64 * Raspberry Pi 4 ARM64 Ubuntu server 20.04 ``` Alias broken: commit fbd945390d32a3804ef8abd3b5c98e479890ddef (HEAD) Author: Alexander Graf <[email protected]> Date: Tue Jun 29 16:13:04 2021 +0200 Internal server error after login: commit 6dc1a1939043efd5b3cc52137c4292a157fe8f33 (HEAD) Merge: 21a362fd fc1a663d Author: Dimitri Huisman <[email protected]> Date: Tue Jun 29 15:26:51 2021 +0200 Alias works: commit fc1a663da2aeb8775dbfa29b01cf065cf237476c (HEAD) Merge: 4ff90683 dd3d03f0 Author: bors[bot] <26634292+bors[bot]@users.noreply.github.com> Date: Tue Jun 29 12:32:21 2021 +0000 ``` @ghostwheel42 ^ can you have a look please? It should still be possible to add the aliases via the cli config-update command. See https://mailu.io/master/cli.html#config-update for more info. Thanks @Diman0. The following command works: ```bash docker-compose exec admin flask mailu alias foo example.net "[email protected],[email protected]" ``` I'm now switched to 1.8 branch which works.
2021-07-24T18:29:20
Mailu/Mailu
1,891
Mailu__Mailu-1891
[ "1738" ]
c48b2ce8bcc63c85be9dc0e510a439de57f69cd8
diff --git a/core/admin/mailu/manage.py b/core/admin/mailu/manage.py --- a/core/admin/mailu/manage.py +++ b/core/admin/mailu/manage.py @@ -386,7 +386,3 @@ def setmanager(domain_name, user_name='manager'): domain.managers.append(manageruser) db.session.add(domain) db.session.commit() - - -if __name__ == '__main__': - cli() diff --git a/core/admin/mailu/models.py b/core/admin/mailu/models.py --- a/core/admin/mailu/models.py +++ b/core/admin/mailu/models.py @@ -15,6 +15,7 @@ import smtplib import idna import dns +import json db = flask_sqlalchemy.SQLAlchemy() @@ -27,7 +28,7 @@ class IdnaDomain(db.TypeDecorator): impl = db.String(80) def process_bind_param(self, value, dialect): - return idna.encode(value).decode("ascii").lower() + return idna.encode(value.lower()).decode('ascii') def process_result_value(self, value, dialect): return idna.decode(value)
Attempting to add an emoji URL in the admin interface results in a 500 ## Before you open your issue - [x] Check if no issue or pull-request for this already exists. - [x] Check [documentation](https://mailu.io/master/) and [FAQ](https://mailu.io/master/faq.html). (Tip, use the search function on the documentation page) - [x] You understand `Mailu` is made by volunteers in their **free time** โ€” be conscise, civil and accept that delays can occur. - [x] The title of the issue should be short and simple. It should contain specific terms related to the actual issue. Be specific while writing the title. ## Environment & Versions ### Environment - [x] docker-compose ### Versions 1.7 ## Description Attempting to add the domain ๐Ÿ’œ๐Ÿณ๏ธโ€โšง๏ธ.ws (or in punycode xn--c8h5289nqoa.ws) results in the web interface returning a 500 status code with the domain not being added. ## Replication Steps Try adding the domain ```xn--c8h5289nqoa.ws``` in the admin interface ## Expected behaviour A 200 status code is returned and the domain is added ## Logs ```` idna.core.InvalidCodepoint: Codepoint U+1F49C at position 1 of '๐Ÿ’œ๐Ÿณโšง' not allowed The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/lib/python3.7/site-packages/flask/app.py", line 2292, in wsgi_app response = self.full_dispatch_request() File "/usr/lib/python3.7/site-packages/flask/app.py", line 1815, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/lib/python3.7/site-packages/flask/app.py", line 1718, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/lib/python3.7/site-packages/flask/_compat.py", line 35, in reraise raise value File "/usr/lib/python3.7/site-packages/flask/app.py", line 1813, in full_dispatch_request rv = self.dispatch_request() File "/usr/lib/python3.7/site-packages/flask/app.py", line 1799, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/usr/lib/python3.7/site-packages/flask_login/utils.py", line 261, in decorated_view return func(*args, **kwargs) File "/app/mailu/ui/access.py", line 36, in wrapper return callback(function, args, kwargs, (), {}) File "/app/mailu/ui/access.py", line 19, in callback return function(*args, **kwargs) File "/app/mailu/ui/views/domains.py", line 22, in domain_create conflicting_domain = models.Domain.query.get(form.name.data) File "/usr/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 959, in get return self._get_impl(ident, loading.load_on_pk_identity) File "/usr/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 1069, in _get_impl return db_load_fn(self, primary_key_identity) File "/usr/lib/python3.7/site-packages/sqlalchemy/orm/loading.py", line 282, in load_on_pk_identity return q.one() File "/usr/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3275, in one ret = self.one_or_none() File "/usr/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3244, in one_or_none ret = list(self) File "/usr/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3317, in __iter__ return self._execute_and_instances(context) File "/usr/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3342, in _execute_and_instances result = conn.execute(querycontext.statement, self._params) File "/usr/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 988, in execute return meth(self, multiparams, params) File "/usr/lib/python3.7/site-packages/sqlalchemy/sql/elements.py", line 287, in _execute_on_connection return connection._execute_clauseelement(self, multiparams, params) File "/usr/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1107, in _execute_clauseelement distilled_params, File "/usr/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context e, util.text_type(statement), parameters, None, None File "/usr/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1466, in _handle_dbapi_exception util.raise_from_cause(sqlalchemy_exception, exc_info) File "/usr/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 383, in raise_from_cause reraise(type(exception), exception, tb=exc_tb, cause=cause) File "/usr/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 128, in reraise raise value.with_traceback(tb) File "/usr/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1179, in _execute_context context = constructor(dialect, self, conn, *args) File "/usr/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 719, in _init_compiled param.append(processors[key](compiled_params[key])) File "/usr/lib/python3.7/site-packages/sqlalchemy/sql/type_api.py", line 1201, in process return process_param(value, dialect) File "/app/mailu/models.py", line 30, in process_bind_param return idna.encode(value).decode("ascii").lower() File "/usr/lib/python3.7/site-packages/idna/core.py", line 358, in encode s = alabel(label) File "/usr/lib/python3.7/site-packages/idna/core.py", line 270, in alabel ulabel(label) File "/usr/lib/python3.7/site-packages/idna/core.py", line 308, in ulabel check_label(label) File "/usr/lib/python3.7/site-packages/idna/core.py", line 261, in check_label raise InvalidCodepoint('Codepoint {0} at position {1} of {2} not allowed'.format(_unot(cp_value), pos+1, repr(label))) sqlalchemy.exc.StatementError: (idna.core.InvalidCodepoint) Codepoint U+1F49C at position 1 of '๐Ÿ’œ๐Ÿณโšง' not allowed [SQL: SELECT domain.created_at AS domain_created_at, domain.updated_at AS domain_updated_at, domain.comment AS domain_comment, domain.name AS domain_name, domain.max_users AS domain_max_users, domain.max_aliases AS domain_max_aliases, domain.max_quota_bytes AS domain_max_quota_bytes, domain.signup_enabled AS domain_signup_enabled FROM domain WHERE domain.name = ?] [parameters: [{'%(140210145585744 param)s': 'xn--c8h5289nqoa.ws'}]] $myIP - - [17/Jan/2021:21:16:17 +0000] "POST /ui/domain/create HTTP/1.1" 500 290 "https://$myDomain/admin/ui/domain/create" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0" ````
Hi @DysphoricUnicorn. I've already fixed this in my unfinished fork/PR for the import/export function. `.lower()` needs to be called _before_ punycode encoding: `return idna.encode(value).decode("ascii").lower()` needs to be replaced with `return idna.encode(value.lower()).decode("ascii")` in models.py line 30. Alex
2021-07-24T18:42:36
Mailu/Mailu
1,896
Mailu__Mailu-1896
[ "1892" ]
bf65a1248f1f2202244b7f44c5894236d5e2e45d
diff --git a/core/admin/mailu/models.py b/core/admin/mailu/models.py --- a/core/admin/mailu/models.py +++ b/core/admin/mailu/models.py @@ -272,7 +272,7 @@ def dkim_publickey(self): return dkim.strip_key(dkim_key).decode('utf8') def generate_dkim_key(self): - """ generate and activate new DKIM key """ + """ generate new DKIM key """ self.dkim_key = dkim.gen_key() def has_email(self, localpart): diff --git a/core/admin/mailu/ui/views/domains.py b/core/admin/mailu/ui/views/domains.py --- a/core/admin/mailu/ui/views/domains.py +++ b/core/admin/mailu/ui/views/domains.py @@ -74,6 +74,8 @@ def domain_details(domain_name): def domain_genkeys(domain_name): domain = models.Domain.query.get(domain_name) or flask.abort(404) domain.generate_dkim_key() + models.db.session.add(domain) + models.db.session.commit() return flask.redirect( flask.url_for(".domain_details", domain_name=domain_name))
DKIM keys aren't generated Hello, I have set up mailu and it's generally working fine, I can add domains and users and receive mail, but I'm unable to proceed with DKIM keys generation. My steps: Click on "details" icon for the domain - I see a table with three lines: DNS MX entry, DNS SPF entries, DNS client auto-configuration (RFC6186) entries. NO DKIM Click "Regenerate Keys" - I see a confirmation prompt Click "Confirm" - A POST request is sent to https://mail.example.com/admin/ui/domain/genkeys/example.com and results in a 302 redirect back to the details page for the domain. But the details still show only the 3 above mentioned lines. DKIM keys do not appear. I don't know if it's relevant but the permissions to the /mailu/dkim directory on the host machine are ``` drwxr-xr-x 2 root root 4096 Jul 24 17:51 dkim ``` I tried setting them temporarily to 777 but that didn't help so I restored them to 755. This directory remains empty before and after the request. ## Environment & Versions ### Environment - [x] docker-compose on Ubuntu 20.04 ### Versions Mailu version is 1.7 ## Logs I've been watching the logs of the antispam and admin containers during the regeneration request. Neither container generates any new log lines at the moment of request. Please let me know how I can help debug the issue or if there's a command I can run in the container manually to generate keys for DKIM. Thanks!
2021-07-25T14:03:17
Mailu/Mailu
1,901
Mailu__Mailu-1901
[ "1900" ]
656cf221264533f66715a6e4abdd2adb1e73dcf1
diff --git a/core/admin/mailu/models.py b/core/admin/mailu/models.py --- a/core/admin/mailu/models.py +++ b/core/admin/mailu/models.py @@ -57,10 +57,9 @@ class IdnaEmail(db.TypeDecorator): def process_bind_param(self, value, dialect): """ encode unicode domain part of email address to punycode """ - localpart, domain_name = value.rsplit('@', 1) + localpart, domain_name = value.lower().rsplit('@', 1) if '@' in localpart: raise ValueError('email local part must not contain "@"') - domain_name = domain_name.lower() return f'{localpart}@{idna.encode(domain_name).decode("ascii")}' def process_result_value(self, value, dialect): @@ -277,6 +276,7 @@ def generate_dkim_key(self): def has_email(self, localpart): """ checks if localpart is configured for domain """ + localpart = localpart.lower() for email in chain(self.users, self.aliases): if email.localpart == localpart: return True @@ -355,8 +355,8 @@ def email(self): @email.setter def email(self, value): """ setter for email - sets _email, localpart and domain_name at once """ - self.localpart, self.domain_name = value.rsplit('@', 1) - self._email = value + self._email = value.lower() + self.localpart, self.domain_name = self._email.rsplit('@', 1) @staticmethod def _update_localpart(target, value, *_): @@ -389,8 +389,7 @@ def sendmail(self, subject, body): def resolve_domain(cls, email): """ resolves domain alternative to real domain """ localpart, domain_name = email.rsplit('@', 1) if '@' in email else (None, email) - alternative = Alternative.query.get(domain_name) - if alternative: + if alternative := Alternative.query.get(domain_name): domain_name = alternative.domain_name return (localpart, domain_name) @@ -401,12 +400,14 @@ def resolve_destination(cls, localpart, domain_name, ignore_forward_keep=False): localpart_stripped = None stripped_alias = None - if os.environ.get('RECIPIENT_DELIMITER') in localpart: - localpart_stripped = localpart.rsplit(os.environ.get('RECIPIENT_DELIMITER'), 1)[0] + delim = os.environ.get('RECIPIENT_DELIMITER') + if delim in localpart: + localpart_stripped = localpart.rsplit(delim, 1)[0] user = User.query.get(f'{localpart}@{domain_name}') if not user and localpart_stripped: user = User.query.get(f'{localpart_stripped}@{domain_name}') + if user: email = f'{localpart}@{domain_name}' @@ -416,15 +417,15 @@ def resolve_destination(cls, localpart, domain_name, ignore_forward_keep=False): destination.append(email) else: destination = [email] + return destination pure_alias = Alias.resolve(localpart, domain_name) - stripped_alias = Alias.resolve(localpart_stripped, domain_name) if pure_alias and not pure_alias.wildcard: return pure_alias.destination - if stripped_alias: + if stripped_alias := Alias.resolve(localpart_stripped, domain_name): return stripped_alias.destination if pure_alias:
Request: case unsensitive mailboxes Hello, It seems like the mail server is handling mails case sensitive, so "[email protected]" will not be received by the mail box "[email protected]" which is not very intuitive. Is it possible to have case unsensitive mail boxes enabled (by config)?
Hmm, are you sure about this? Here I have everything lowercase... but I can definitely receive emails with upper cases both on the user and domain parts. hmm... I begin to believe that my installation is cursed... Maybe I screwed up with some override configs... I will check that. I disabled my overrides, it still happens. My catch-all address is getting the mails. From: [email protected] To: [email protected] Mail-Address for catch all: [email protected] Logs: ``` smtp_1 | Jul 29 08:09:37 mail postfix[104]: Postfix is running with backwards-compatible default settings smtp_1 | Jul 29 08:09:37 mail postfix[104]: See http://www.postfix.org/COMPATIBILITY_README.html for details smtp_1 | Jul 29 08:09:37 mail postfix[104]: To disable backwards compatibility use "postconf compatibility_level=2" and "postfix reload" smtp_1 | Jul 29 08:09:39 mail postfix[319]: Postfix is running with backwards-compatible default settings smtp_1 | Jul 29 08:09:39 mail postfix[319]: See http://www.postfix.org/COMPATIBILITY_README.html for details smtp_1 | Jul 29 08:09:39 mail postfix[319]: To disable backwards compatibility use "postconf compatibility_level=2" and "postfix reload" smtp_1 | Jul 29 08:09:40 mail postfix/postfix-script[385]: starting the Postfix mail system smtp_1 | Jul 29 08:09:40 mail postfix/master[386]: daemon started -- version 3.5.12, configuration /etc/postfix smtp_1 | Jul 29 08:10:04 mail postfix/smtpd[398]: connect from localhost[127.0.0.1] smtp_1 | Jul 29 08:10:04 mail postfix/smtpd[398]: disconnect from localhost[127.0.0.1] quit=1 commands=1 smtp_1 | Jul 29 08:10:35 mail postfix/smtpd[398]: connect from localhost[127.0.0.1] smtp_1 | Jul 29 08:10:35 mail postfix/smtpd[398]: disconnect from localhost[127.0.0.1] quit=1 commands=1 smtp_1 | Jul 29 08:11:05 mail postfix/smtpd[398]: connect from localhost[127.0.0.1] smtp_1 | Jul 29 08:11:05 mail postfix/smtpd[398]: disconnect from localhost[127.0.0.1] quit=1 commands=1 smtp_1 | Jul 29 08:11:35 mail postfix/smtpd[398]: connect from localhost[127.0.0.1] smtp_1 | Jul 29 08:11:35 mail postfix/smtpd[398]: disconnect from localhost[127.0.0.1] quit=1 commands=1 smtp_1 | Jul 29 08:12:05 mail postfix/smtpd[398]: connect from localhost[127.0.0.1] smtp_1 | Jul 29 08:12:05 mail postfix/smtpd[398]: disconnect from localhost[127.0.0.1] quit=1 commands=1 smtp_1 | Jul 29 08:12:21 mail postfix/smtpd[434]: connect from unknown[172.18.0.1] smtp_1 | Jul 29 08:12:21 mail postfix/smtpd[434]: 5928612CB6C: client=unknown[ip.ip.ip.ip], sasl_method=XCLIENT, [email protected] smtp_1 | Jul 29 08:12:21 mail postfix/cleanup[438]: 5928612CB6C: replace: header Received: from AM0PR06MB5537.eurprd06.prod.outlook.com (unknown [ip.ip.ip.ip])??by mailserver.domain.tld (Postfix) with ESMTPA id 5928612CB6C??for <[email protected]>; Thu, 29 Jul 2021 08:12:21 +000 from unknown[ip.ip.ip.ip]; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<AM0PR06MB5537.eurprd06.prod.outlook.com>: Received: from authenticated-user (mailserver.domain.tld [serverip.serverip.serverip.serverip])??by mailserver.domain.tld (Postfix) with ESMTPA id 5928612CB6C??for <[email protected]>; Thu, 29 Jul 2021 08:12:21 +0000 (UTC) smtp_1 | Jul 29 08:12:21 mail postfix/cleanup[438]: 5928612CB6C: message-id=<AM0PR06MB5537158BD698B9EACA2E63C0FAEB9@AM0PR06MB5537.eurprd06.prod.outlook.com> smtp_1 | Jul 29 08:12:21 mail postfix/qmgr[388]: 5928612CB6C: from=<[email protected]>, size=1741, nrcpt=1 (queue active) smtp_1 | Jul 29 08:12:21 mail postfix/smtpd[434]: disconnect from unknown[ip.ip.ip.ip] ehlo=2 xclient=0/1 mail=1 rcpt=1 data=1 quit=1 commands=6/7 smtp_1 | Jul 29 08:12:21 mail postfix/lmtp[439]: 5928612CB6C: to=<[email protected]>, orig_to=<[email protected]>, relay=172.18.0.7[172.18.0.7]:2525, delay=0.51, delays=0.38/0.02/0.01/0.1, dsn=2.0.0, status=sent (250 2.0.0 <[email protected]> hCHJKuViAmFRAAAAIuytJQ Saved) smtp_1 | Jul 29 08:12:21 mail postfix/qmgr[388]: 5928612CB6C: removed smtp_1 | Jul 29 08:12:35 mail postfix/smtpd[398]: connect from localhost[127.0.0.1] smtp_1 | Jul 29 08:12:35 mail postfix/smtpd[398]: disconnect from localhost[127.0.0.1] quit=1 commands=1 smtp_1 | Jul 29 08:12:48 mail postfix/smtpd[434]: connect from unknown[172.18.0.1] smtp_1 | Jul 29 08:12:48 mail postfix/smtpd[434]: 8761212C3BF: client=unknown[ip.ip.ip.ip], sasl_method=XCLIENT, [email protected] smtp_1 | Jul 29 08:12:48 mail postfix/cleanup[438]: 8761212C3BF: replace: header Received: from AM0PR06MB5537.eurprd06.prod.outlook.com (unknown [ip.ip.ip.ip])??by mailserver.domain.tld (Postfix) with ESMTPA id 8761212C3BF??for <[email protected]>; Thu, 29 Jul 2021 08:12:48 +000 from unknown[ip.ip.ip.ip]; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<AM0PR06MB5537.eurprd06.prod.outlook.com>: Received: from authenticated-user (mailserver.domain.tld [serverip.serverip.serverip.serverip])??by mailserver.domain.tld (Postfix) with ESMTPA id 8761212C3BF??for <[email protected]>; Thu, 29 Jul 2021 08:12:48 +0000 (UTC) smtp_1 | Jul 29 08:12:48 mail postfix/cleanup[438]: 8761212C3BF: message-id=<AM0PR06MB55379A9FD7E4A515BF6F605DFAEB9@AM0PR06MB5537.eurprd06.prod.outlook.com> smtp_1 | Jul 29 08:12:48 mail postfix/qmgr[388]: 8761212C3BF: from=<[email protected]>, size=1741, nrcpt=1 (queue active) smtp_1 | Jul 29 08:12:48 mail postfix/smtpd[434]: disconnect from unknown[ip.ip.ip.ip] ehlo=2 xclient=0/1 mail=1 rcpt=1 data=1 quit=1 commands=6/7 smtp_1 | Jul 29 08:12:48 mail postfix/lmtp[439]: 8761212C3BF: to=<[email protected]>, orig_to=<[email protected]>, relay=172.18.0.7[172.18.0.7]:2525, delay=0.19, delays=0.08/0/0/0.11, dsn=2.0.0, status=sent (250 2.0.0 <[email protected]> EC/3IwBjAmFRAAAAIuytJQ Saved) smtp_1 | Jul 29 08:12:48 mail postfix/qmgr[388]: 8761212C3BF: removed smtp_1 | Jul 29 08:13:05 mail postfix/smtpd[398]: connect from localhost[127.0.0.1] smtp_1 | Jul 29 08:13:05 mail postfix/smtpd[398]: disconnect from localhost[127.0.0.1] quit=1 commands=1 ``` Please stick to the reporting template. I have tried and managed to receive emails sent to [email protected] (see https://mailu.io/master/demo.html). Please replicate what you think is relevant of your configuration on the test server and submit a new report if you can reproduce it.
2021-07-30T20:30:44
Mailu/Mailu
1,902
Mailu__Mailu-1902
[ "1558" ]
a461f5fa7c82898baed23a68b05fa86cf205bbea
diff --git a/core/postfix/start.py b/core/postfix/start.py --- a/core/postfix/start.py +++ b/core/postfix/start.py @@ -68,6 +68,12 @@ def is_valid_postconf_line(line): os.system("postmap {}".format(destination)) os.remove(destination) +if not os.path.exists("/etc/postfix/tls_policy.map.db"): + with open("/etc/postfix/tls_policy.map", "w") as f: + for domain in ['gmail.com', 'yahoo.com', 'hotmail.com', 'aol.com', 'outlook.com', 'comcast.net', 'icloud.com', 'msn.com', 'hotmail.co.uk', 'live.com', 'yahoo.co.in', 'me.com', 'mail.ru', 'cox.net', 'yahoo.co.uk', 'verizon.net', 'ymail.com', 'hotmail.it', 'kw.com', 'yahoo.com.tw', 'mac.com', 'live.se', 'live.nl', 'yahoo.com.br', 'googlemail.com', 'libero.it', 'web.de', 'allstate.com', 'btinternet.com', 'online.no', 'yahoo.com.au', 'live.dk', 'earthlink.net', 'yahoo.fr', 'yahoo.it', 'gmx.de', 'hotmail.fr', 'shawinc.com', 'yahoo.de', 'moe.edu.sg', 'naver.com', 'bigpond.com', 'statefarm.com', 'remax.net', 'rocketmail.com', 'live.no', 'yahoo.ca', 'bigpond.net.au', 'hotmail.se', 'gmx.at', 'live.co.uk', 'mail.com', 'yahoo.in', 'yandex.ru', 'qq.com', 'charter.net', 'indeedemail.com', 'alice.it', 'hotmail.de', 'bluewin.ch', 'optonline.net', 'wp.pl', 'yahoo.es', 'hotmail.no', 'pindotmedia.com', 'orange.fr', 'live.it', 'yahoo.co.id', 'yahoo.no', 'hotmail.es', 'morganstanley.com', 'wellsfargo.com', 'wanadoo.fr', 'facebook.com', 'yahoo.se', 'fema.dhs.gov', 'rogers.com', 'yahoo.com.hk', 'live.com.au', 'nic.in', 'nab.com.au', 'ubs.com', 'shaw.ca', 'umich.edu', 'westpac.com.au', 'yahoo.com.mx', 'yahoo.com.sg', 'farmersagent.com', 'yahoo.dk', 'dhs.gov']: + f.write(f'{domain}\tsecure\n') + os.system("postmap /etc/postfix/tls_policy.map") + if "RELAYUSER" in os.environ: path = "/etc/postfix/sasl_passwd" conf.jinja("/conf/sasl_passwd", os.environ, path)
Make smtp_tls_policy_maps easily configurable Hi Team, It will be great to have following options configurable from mailu.env as they are required in many cases when SMTP RELAY from an ISP is in use: smtp_tls_security_level smtp_tls_wrappermode (PR is following)
Hi There, The `Mailu`-Project is currently in a bit of a bind! We are short on man-power, and we need to judge if it is possible for us to put in some work on this issue. To help with that, we are currently trying to find out which issues are actively keeping users from using `Mailu`, which issues have someone who want to work on them โ€” and which issues may be less important. These a less important ones could be discarded for the time being, until the project is in a more stable and regular state once again. In order for us to better assess this, it would be helpful if you could put a **reaction on this post** (use the :smiley: icon to the top-right). - ๐Ÿ‘๏ธ if you **need this** to be able to use Mailu. Ideally, youโ€™d also be able to test this on your installation, and provide feedback โ€ฆ - ๐ŸŽ‰ if you find it a **nice bonus**, but no deal-breaker - ๐Ÿš€ if you want to **work on it yourself**! We want to keep this **voting open for 2 weeks** from now, so please help out! It's already done and PR is pending to be approved and merged This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. What recent activity is expected here? PR just pending to be reviewed and hopefully merged > Hi There, > > The `Mailu`-Project is currently in a bit of a bind! We are short on man-power, and we need to judge if it is possible for us to put in some work on this issue. > > To help with that, we are currently trying to find out which issues are actively keeping users from using `Mailu`, which issues have someone who want to work on them โ€” and which issues may be less important. These a less important ones could be discarded for the time being, until the project is in a more stable and regular state once again. > > In order for us to better assess this, it would be helpful if you could put a **reaction on this post** (use the ๐Ÿ˜ƒ icon to the top-right). > > * ๐Ÿ‘๏ธ if you **need this** to be able to use Mailu. Ideally, youโ€™d also be able to test this on your installation, and provide feedback โ€ฆ > * ๐ŸŽ‰ if you find it a **nice bonus**, but no deal-breaker > * ๐Ÿš€ if you want to **work on it yourself**! > We want to keep this **voting open for 2 weeks** from now, so please help out! Hi, I appreciate your business with the project a lot, at the same time my PR with few lines of changes is "only" 1 year old. Could you kindly review it and either merge or just cancel? It is sitting and waiting for something really unknown to happen Regards Sergiy We've discussed this on #mailu-dev recently ... and can't see a usecase for smtp_tls_wrappermode. You can already specify a port in the relay host field... and force SMTPS that way (fqdn-of-smtpd.example.com:465) That being said, it would be great if settings could be specified for specific destinations (GAFAs are unlikely to get their TLS setup wrong so we could force a secure connection there). Having a configurable (or easily overridable) smtp_tls_policy_maps would make sense and could cover relays.
2021-08-01T09:15:09
Mailu/Mailu
1,904
Mailu__Mailu-1904
[ "1096" ]
b57df78dacf22592cf195c9d02eeef1a5002696b
diff --git a/core/admin/mailu/configuration.py b/core/admin/mailu/configuration.py --- a/core/admin/mailu/configuration.py +++ b/core/admin/mailu/configuration.py @@ -32,6 +32,7 @@ 'DOMAIN': 'mailu.io', 'HOSTNAMES': 'mail.mailu.io,alternative.mailu.io,yetanother.mailu.io', 'POSTMASTER': 'postmaster', + 'WILDCARD_SENDERS': '', 'TLS_FLAVOR': 'cert', 'INBOUND_TLS_ENFORCE': False, 'AUTH_RATELIMIT': '1000/minute;10000/hour', diff --git a/core/admin/mailu/internal/views/postfix.py b/core/admin/mailu/internal/views/postfix.py --- a/core/admin/mailu/internal/views/postfix.py +++ b/core/admin/mailu/internal/views/postfix.py @@ -133,10 +133,12 @@ def postfix_sender_map(sender): @internal.route("/postfix/sender/login/<path:sender>") def postfix_sender_login(sender): + wildcard_senders = [s for s in flask.current_app.config.get('WILDCARD_SENDERS', '').lower().replace(' ', '').split(',') if s] localpart, domain_name = models.Email.resolve_domain(sender) if localpart is None: - return flask.abort(404) + return flask.jsonify(",".join(wildcard_senders)) if wildcard_senders else flask.abort(404) destination = models.Email.resolve_destination(localpart, domain_name, True) + destination = [*destination, *wildcard_senders] if destination else [*wildcard_senders] return flask.jsonify(",".join(destination)) if destination else flask.abort(404) @internal.route("/postfix/sender/rate/<path:sender>")
Allow specific users to send email from any address Before switching to Mailu I had postfix set up so that my admin user `[email protected]` could impersonate / send email as any other user. This was extremely useful for sending email programmatically from multiple sources, e.g. from a web app that needs to send email from `*@mydomain.dev` and several other domains like `*@admin.mydomain.dev`/`*@someotherdomain.dev`. I suspect I can add something into `overrides/postfix.conf` to get this behavior back, but I'm not sure how to do it since I only want a specific user to be able to impersonate others, not all users. Ideally there would be a UI page to configure the permitted sender addresses for each user, with sqlite-style wildcard support. ```ini smtpd_client_restrictions = permit_mynetworks, check_sender_access ${podop}senderaccess, reject_non_fqdn_sender, reject_unknown_sender_domain, reject_unknown_recipient_domain, reject_unverified_recipient, permit smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination ``` For now, given I'm the only one using the server and I need this behavior back ASAP, can I just remove the `check_sender_access ${podop}senderaccess,` line? Or is there a better long-term fix? I also cant just use `RELAYNETS` with some whitelisted IPs becuase the servers doing the sending have dynamic IP addresses that often change, I need it to be whitelisted on a per-user basis not a per-sender-ip basis. **Useful links:** - https://github.com/Mailu/Mailu/blob/master/core/postfix/conf/main.cf - http://www.postfix.org/ADDRESS_VERIFICATION_README.html - http://www.postfix.org/postconf.5.html#check_sender_access
Using relaynets is probably better advised, since removing sender access will also allow illegitimate impersonation from anywhere, even external scammers. Then, depending on your setup you could use aliases: a user can impersonate any alias that points to its address. Otherwise we will need to implement this while it is not entirely trivial: sender access verifications do not pass the authenticated user to the background. Wait but isn't it all authenticated with the SMTP credentials? How would a spammer be able to send from anywhere if they don't have SMTP credentials for the server? All registered user accounts on this server are trusted, it's just me and a couple other people, so there's no chance of users that have SMTP credentials / registered accounts being spammers. I just want to authorize a single SMTP user/pass to be able to send from `%@mydomain.com` (or even better, `%@%` without domain validation). I tried the alias setup you suggested, the problem is that the alias for `%@mydomain.com` that allows it to send from any address conflicts with other accounts and becomes a catch-all for received mail, I just want to allow arbitrary sending without changing the received mail routing. > I also cant just use RELAYNETS with some whitelisted IPs becuase the servers doing the sending have dynamic IP addresses that often change. Incoming mail using is not authenticated: SMTP only supports authenticating local users, remote users aren't. And sender access is the set of rules that makes sure that remote servers cannot impersonate your local users, among other things. Also, the catch all alias is probably the simplest way to go. It should not conflict with any other alias or local user since it should have the lowest priority. It will just act as a default catch all. Right, I know incoming mail isn't authenticated, I meant for outgoing mail. > makes sure that remote servers cannot impersonate your local users, among other things. This is exactly what I'm trying to accomplish, I need my servers to be able to send from `*@allmydomains.com` using one set of SMTP credentials. I already tried the catchall, it didn't work, all relayed emails got rejected due to sender addresses not being owned by the SMTP user.
2021-08-02T17:20:35
Mailu/Mailu
1,910
Mailu__Mailu-1910
[ "1867" ]
bfb2665d587dc410bebdee0e05ae3641a53d7839
diff --git a/core/admin/mailu/configuration.py b/core/admin/mailu/configuration.py --- a/core/admin/mailu/configuration.py +++ b/core/admin/mailu/configuration.py @@ -34,8 +34,8 @@ 'POSTMASTER': 'postmaster', 'TLS_FLAVOR': 'cert', 'INBOUND_TLS_ENFORCE': False, - 'AUTH_RATELIMIT': '10/minute;1000/hour', - 'AUTH_RATELIMIT_SUBNET': True, + 'AUTH_RATELIMIT': '1000/minute;10000/hour', + 'AUTH_RATELIMIT_SUBNET': False, 'DISABLE_STATISTICS': False, # Mail settings 'DMARC_RUA': None,
Rate limiting changes for 1.8 Copied from #1582. For 1.8 we will for now increase rate limiting value and disable rate limiting for the subnet. - Rate limiting - Document rate limiting - Currently the subnet is included in the rate limiting. This means that a user who repeatly fails to login the webmail, blocks the webmail for ALL users. - For 1.8 and master - in mailu.env set the rate limit to a high value. - in mailu.env disable the rate limiter for the subnet. - And document this of course and change this in the documentation - Set status blocked on lubs pull request and request to further discuss this for mailu 1.9. - Make authentication fast #1745 is a draft pr from nextgens which contains a solution for this problem. - We need a new issue and PR for making these changes.
Work to be done for the above: - subnet rate limiting: - Change in docs/configuration.rst that AUTH_RATELIMIT_SUBNET is set to False by default. - Change in core/admin/mailu/configuration.py the default value of AUTH_RATELIMIT_SUBNET to False. - Triple check it is safe to backport this to 1.8. Otherwise this must be done in 2 separate PRs. One on branch 1.8 and one on branch master. - higher default rate limit - Add to towncrier newsfragment that I must not forget to document this in the release notes (once 1.8 is released) that we increased the default value for rate limiting. - Change in [config.html](https://github.com/Mailu/Mailu/blob/56a6821875a2742e18e087e681b97f6820edde9a/setup/templates/steps/config.html#L54) the default value of 10 to a high value. I will change the default value to 10000/minute . I think this is high enough to prevent any issues.
2021-08-06T14:46:02
Mailu/Mailu
1,925
Mailu__Mailu-1925
[ "1924" ]
3a96bf21701334370d6ffda25c4d7c5f6409ddf0
diff --git a/webmails/rainloop/start.py b/webmails/rainloop/start.py --- a/webmails/rainloop/start.py +++ b/webmails/rainloop/start.py @@ -19,12 +19,11 @@ os.makedirs(base + "domains", exist_ok=True) os.makedirs(base + "configs", exist_ok=True) -conf.jinja("/default.ini", os.environ, "/data/_data_/_default_/domains/default.ini") -conf.jinja("/application.ini", os.environ, "/data/_data_/_default_/configs/application.ini") -conf.jinja("/php.ini", os.environ, "/usr/local/etc/php/conf.d/rainloop.ini") +conf.jinja("/defaults/default.ini", os.environ, "/data/_data_/_default_/domains/default.ini") +conf.jinja("/defaults/application.ini", os.environ, "/data/_data_/_default_/configs/application.ini") +conf.jinja("/defaults/php.ini", os.environ, "/etc/php7/php.ini") -os.system("chown -R www-data:www-data /data") -os.system("chmod -R a+rX /var/www/html/") - -os.execv("/usr/local/bin/apache2-foreground", ["apache2-foreground"]) +os.system("chown -R nginx:nginx /data") +os.system("chmod -R a+rX /var/www/rainloop/") +os.execv("/usr/sbin/nginx", ["nginx", "-g", "daemon off;"])
Optimize Rainloop image ## Before you open your issue - [X] Check if no issue or pull-request for this already exists. - [X] Check [documentation](https://mailu.io/master/) and [FAQ](https://mailu.io/master/faq.html). (Tip, use the search function on the documentation page) - [X] You understand `Mailu` is made by volunteers in their **free time** โ€” be conscise, civil and accept that delays can occur. - [X] The title of the issue should be short and simple. It should contain specific terms related to the actual issue. Be specific while writing the title. ## Environment & Versions ### Environment - [X] docker-compose - [X] kubernetes - [X] docker swarm ### Versions Master ``` $> docker images mailu/rainloop master 2ad8d1c29ff3 45 hours ago 607MB ``` Optimized version using NGINX: ``` user/rainloop master 7de9dee9286d 2 seconds ago 116MB ``` ## Description In order to resolve issues #1830 and #1200, it is required to reduce build time, complexity and image size of images before multi-architecture builds can be supported. The current Rainloop image size is 607MB and can be optimized when changing from Apache to NGINX with officially supported Docker images. This can also increase overall web performance.
2021-08-10T20:05:54
Mailu/Mailu
1,941
Mailu__Mailu-1941
[ "1270", "1270" ]
7efce99769ac62e928c88c68c8c0269a8031fe94
diff --git a/core/nginx/letsencrypt.py b/core/nginx/letsencrypt.py --- a/core/nginx/letsencrypt.py +++ b/core/nginx/letsencrypt.py @@ -13,6 +13,7 @@ "--cert-name", "mailu", "--preferred-challenges", "http", "--http-01-port", "8008", "--keep-until-expiring", + "--renew-with-new-domains", "--config-dir", "/certs/letsencrypt", "--post-hook", "/config.py" ] @@ -26,6 +27,7 @@ "--preferred-challenges", "http", "--http-01-port", "8008", "--keep-until-expiring", "--key-type", "ecdsa", + "--renew-with-new-domains", "--config-dir", "/certs/letsencrypt", "--post-hook", "/config.py" ]
Letsencrypt Force Renewal Is there a limit on the Subject Alt Name entries? I have updated my /mailu/mailu.env "HOSTNAMES" variable, but when I restart Mailu it doesn't update the Subject Alt Names on the mailu cert. Previously it has worked, so I am guessing that I need to force Letsencrypt to refresh as it isnt within the renewal window. But there is no guidance for the new letsencrypt certbot. I am using the latest Mailu version (1.7) and this is the command I am using to restart mailu '/mailu/docker-compose -p mailu up -d' Letsencrypt Force Renewal Is there a limit on the Subject Alt Name entries? I have updated my /mailu/mailu.env "HOSTNAMES" variable, but when I restart Mailu it doesn't update the Subject Alt Names on the mailu cert. Previously it has worked, so I am guessing that I need to force Letsencrypt to refresh as it isnt within the renewal window. But there is no guidance for the new letsencrypt certbot. I am using the latest Mailu version (1.7) and this is the command I am using to restart mailu '/mailu/docker-compose -p mailu up -d'
you can force renewal by attaching to the mailu_front container and running the following python script with some modifications. It is extracted from this repository. https://github.com/Mailu/Mailu/blob/master/core/nginx/letsencrypt.py What I did to solve the same problem, was to replace the `--keep-until-expiry` with `--force-renewal`, and then i removed the part on the bottom that will try to renew every hour, because we don't need that for running this once. You can attach to the docker container by: 1. first finding the container id with `docker ps` 2. execute: `docker exec -it [container id here] /bin/bash` 3. Inside the container, run `python3`. This will launch the python shell. 4. Paste the entire code you modified inside, and let it finish. 5. When done, the script should finish. Press `CTRL+D` to exit the python shell. 6. type `exit` to exit the container. Done! This will force a renewal of the certificate using letsencrypt. Hi There, The `Mailu`-Project is currently in a bit of a bind! We are short on man-power, and we need to judge if it is possible for us to put in some work on this issue. To help with that, we are currently trying to find out which issues are actively keeping users from using `Mailu`, which issues have someone who want to work on them โ€” and which issues may be less important. These a less important ones could be discarded for the time being, until the project is in a more stable and regular state once again. In order for us to better assess this, it would be helpful if you could put a **reaction on this post** (use the :smiley: icon to the top-right). - ๐Ÿ‘๏ธ if you **need this** to be able to use Mailu. Ideally, youโ€™d also be able to test this on your installation, and provide feedback โ€ฆ - ๐ŸŽ‰ if you find it a **nice bonus**, but no deal-breaker - ๐Ÿš€ if you want to **work on it yourself**! We want to keep this **voting open for 2 weeks** from now, so please help out! This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. thanks to @dennorske i got it renewed: ``` $ docker ps | grep mailu_front $ docker exec -it [container id here] /bin/bash bash-5.0# certbot -n --agree-tos -d $HOSTNAMES -m $POSTMASTER@$DOMAIN certonly --standalone --cert-name mailu --preferred-challenges http --http-01-port 8008 --force-renewal --rsa-key-size 4096 --config-dir /certs/letsencrypt --post-hook /config.py $ CTRL-D # if you use a proxy own nginx $ sudo service nginx restart ``` -> this sould probably also go to the FAQ or docs According to https://certbot.eff.org/docs/using.html#changing-a-certificate-s-domains it should just work. https://github.com/Mailu/Mailu/blob/08a39aac4939e409d72d9b350b771d46e2b5dcae/core/nginx/letsencrypt.py#L11 is what is done under the hood... maybe the version of certbot shipped in 1.7 is buggy/too old? I unfortunately did not check what the underlying reason was for the failed renewals - but it turned out forcing it did the trick. I haven't had issues since. @delijati Im getting trying your solution, Im pretty sure Im missing something, but not sure of what, I did double check in the A/AAA and all is correct ![Screen Shot 2021-08-06 at 11 40 04](https://user-images.githubusercontent.com/6392815/128543808-1c9e31c5-3e51-4875-ae13-908d60cf62b0.png) > @delijati Im getting trying your solution, Im pretty sure Im missing something, but not sure of what, I did double check in the A/AAA and all is correct > > ![Screen Shot 2021-08-06 at 11 40 04](https://user-images.githubusercontent.com/6392815/128543808-1c9e31c5-3e51-4875-ae13-908d60cf62b0.png) This unfortunately seems unrelated to this issue, as it is in fact trying to renew. It also states connection refused leading me to believe it could be a misconfiguration or firewall issue. Oh I see, just ! question in python code, why the config "http --http-01-port 8008" have a port 8008 why 8008 ? it should be 8008? Because that's the port that's reverse-proxied by front/NGINX see https://github.com/Mailu/Mailu/blob/08a39aac4939e409d72d9b350b771d46e2b5dcae/core/nginx/conf/nginx.conf#L82 you can force renewal by attaching to the mailu_front container and running the following python script with some modifications. It is extracted from this repository. https://github.com/Mailu/Mailu/blob/master/core/nginx/letsencrypt.py What I did to solve the same problem, was to replace the `--keep-until-expiry` with `--force-renewal`, and then i removed the part on the bottom that will try to renew every hour, because we don't need that for running this once. You can attach to the docker container by: 1. first finding the container id with `docker ps` 2. execute: `docker exec -it [container id here] /bin/bash` 3. Inside the container, run `python3`. This will launch the python shell. 4. Paste the entire code you modified inside, and let it finish. 5. When done, the script should finish. Press `CTRL+D` to exit the python shell. 6. type `exit` to exit the container. Done! This will force a renewal of the certificate using letsencrypt. Hi There, The `Mailu`-Project is currently in a bit of a bind! We are short on man-power, and we need to judge if it is possible for us to put in some work on this issue. To help with that, we are currently trying to find out which issues are actively keeping users from using `Mailu`, which issues have someone who want to work on them โ€” and which issues may be less important. These a less important ones could be discarded for the time being, until the project is in a more stable and regular state once again. In order for us to better assess this, it would be helpful if you could put a **reaction on this post** (use the :smiley: icon to the top-right). - ๐Ÿ‘๏ธ if you **need this** to be able to use Mailu. Ideally, youโ€™d also be able to test this on your installation, and provide feedback โ€ฆ - ๐ŸŽ‰ if you find it a **nice bonus**, but no deal-breaker - ๐Ÿš€ if you want to **work on it yourself**! We want to keep this **voting open for 2 weeks** from now, so please help out! This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. thanks to @dennorske i got it renewed: ``` $ docker ps | grep mailu_front $ docker exec -it [container id here] /bin/bash bash-5.0# certbot -n --agree-tos -d $HOSTNAMES -m $POSTMASTER@$DOMAIN certonly --standalone --cert-name mailu --preferred-challenges http --http-01-port 8008 --force-renewal --rsa-key-size 4096 --config-dir /certs/letsencrypt --post-hook /config.py $ CTRL-D # if you use a proxy own nginx $ sudo service nginx restart ``` -> this sould probably also go to the FAQ or docs According to https://certbot.eff.org/docs/using.html#changing-a-certificate-s-domains it should just work. https://github.com/Mailu/Mailu/blob/08a39aac4939e409d72d9b350b771d46e2b5dcae/core/nginx/letsencrypt.py#L11 is what is done under the hood... maybe the version of certbot shipped in 1.7 is buggy/too old? I unfortunately did not check what the underlying reason was for the failed renewals - but it turned out forcing it did the trick. I haven't had issues since. @delijati Im getting trying your solution, Im pretty sure Im missing something, but not sure of what, I did double check in the A/AAA and all is correct ![Screen Shot 2021-08-06 at 11 40 04](https://user-images.githubusercontent.com/6392815/128543808-1c9e31c5-3e51-4875-ae13-908d60cf62b0.png) > @delijati Im getting trying your solution, Im pretty sure Im missing something, but not sure of what, I did double check in the A/AAA and all is correct > > ![Screen Shot 2021-08-06 at 11 40 04](https://user-images.githubusercontent.com/6392815/128543808-1c9e31c5-3e51-4875-ae13-908d60cf62b0.png) This unfortunately seems unrelated to this issue, as it is in fact trying to renew. It also states connection refused leading me to believe it could be a misconfiguration or firewall issue. Oh I see, just ! question in python code, why the config "http --http-01-port 8008" have a port 8008 why 8008 ? it should be 8008? Because that's the port that's reverse-proxied by front/NGINX see https://github.com/Mailu/Mailu/blob/08a39aac4939e409d72d9b350b771d46e2b5dcae/core/nginx/conf/nginx.conf#L82
2021-08-23T17:44:11
Mailu/Mailu
1,944
Mailu__Mailu-1944
[ "1270" ]
4fb4d56ce070f90f8338021bda77c2884309b91f
diff --git a/core/nginx/letsencrypt.py b/core/nginx/letsencrypt.py --- a/core/nginx/letsencrypt.py +++ b/core/nginx/letsencrypt.py @@ -14,8 +14,8 @@ "--cert-name", "mailu", "--preferred-challenges", "http", "--http-01-port", "8008", "--keep-until-expiring", - "--rsa-key-size", "4096", "--config-dir", "/certs/letsencrypt", + "--renew-with-new-domains", "--post-hook", "/config.py" ]
Letsencrypt Force Renewal Is there a limit on the Subject Alt Name entries? I have updated my /mailu/mailu.env "HOSTNAMES" variable, but when I restart Mailu it doesn't update the Subject Alt Names on the mailu cert. Previously it has worked, so I am guessing that I need to force Letsencrypt to refresh as it isnt within the renewal window. But there is no guidance for the new letsencrypt certbot. I am using the latest Mailu version (1.7) and this is the command I am using to restart mailu '/mailu/docker-compose -p mailu up -d'
you can force renewal by attaching to the mailu_front container and running the following python script with some modifications. It is extracted from this repository. https://github.com/Mailu/Mailu/blob/master/core/nginx/letsencrypt.py What I did to solve the same problem, was to replace the `--keep-until-expiry` with `--force-renewal`, and then i removed the part on the bottom that will try to renew every hour, because we don't need that for running this once. You can attach to the docker container by: 1. first finding the container id with `docker ps` 2. execute: `docker exec -it [container id here] /bin/bash` 3. Inside the container, run `python3`. This will launch the python shell. 4. Paste the entire code you modified inside, and let it finish. 5. When done, the script should finish. Press `CTRL+D` to exit the python shell. 6. type `exit` to exit the container. Done! This will force a renewal of the certificate using letsencrypt. Hi There, The `Mailu`-Project is currently in a bit of a bind! We are short on man-power, and we need to judge if it is possible for us to put in some work on this issue. To help with that, we are currently trying to find out which issues are actively keeping users from using `Mailu`, which issues have someone who want to work on them โ€” and which issues may be less important. These a less important ones could be discarded for the time being, until the project is in a more stable and regular state once again. In order for us to better assess this, it would be helpful if you could put a **reaction on this post** (use the :smiley: icon to the top-right). - ๐Ÿ‘๏ธ if you **need this** to be able to use Mailu. Ideally, youโ€™d also be able to test this on your installation, and provide feedback โ€ฆ - ๐ŸŽ‰ if you find it a **nice bonus**, but no deal-breaker - ๐Ÿš€ if you want to **work on it yourself**! We want to keep this **voting open for 2 weeks** from now, so please help out! This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. thanks to @dennorske i got it renewed: ``` $ docker ps | grep mailu_front $ docker exec -it [container id here] /bin/bash bash-5.0# certbot -n --agree-tos -d $HOSTNAMES -m $POSTMASTER@$DOMAIN certonly --standalone --cert-name mailu --preferred-challenges http --http-01-port 8008 --force-renewal --rsa-key-size 4096 --config-dir /certs/letsencrypt --post-hook /config.py $ CTRL-D # if you use a proxy own nginx $ sudo service nginx restart ``` -> this sould probably also go to the FAQ or docs According to https://certbot.eff.org/docs/using.html#changing-a-certificate-s-domains it should just work. https://github.com/Mailu/Mailu/blob/08a39aac4939e409d72d9b350b771d46e2b5dcae/core/nginx/letsencrypt.py#L11 is what is done under the hood... maybe the version of certbot shipped in 1.7 is buggy/too old? I unfortunately did not check what the underlying reason was for the failed renewals - but it turned out forcing it did the trick. I haven't had issues since. @delijati Im getting trying your solution, Im pretty sure Im missing something, but not sure of what, I did double check in the A/AAA and all is correct ![Screen Shot 2021-08-06 at 11 40 04](https://user-images.githubusercontent.com/6392815/128543808-1c9e31c5-3e51-4875-ae13-908d60cf62b0.png) > @delijati Im getting trying your solution, Im pretty sure Im missing something, but not sure of what, I did double check in the A/AAA and all is correct > > ![Screen Shot 2021-08-06 at 11 40 04](https://user-images.githubusercontent.com/6392815/128543808-1c9e31c5-3e51-4875-ae13-908d60cf62b0.png) This unfortunately seems unrelated to this issue, as it is in fact trying to renew. It also states connection refused leading me to believe it could be a misconfiguration or firewall issue. Oh I see, just ! question in python code, why the config "http --http-01-port 8008" have a port 8008 why 8008 ? it should be 8008? Because that's the port that's reverse-proxied by front/NGINX see https://github.com/Mailu/Mailu/blob/08a39aac4939e409d72d9b350b771d46e2b5dcae/core/nginx/conf/nginx.conf#L82
2021-08-23T20:18:05
Mailu/Mailu
1,957
Mailu__Mailu-1957
[ "1952" ]
ecb39fed04b6ec4d486556044ccaf2102cde6196
diff --git a/core/admin/mailu/internal/views/auth.py b/core/admin/mailu/internal/views/auth.py --- a/core/admin/mailu/internal/views/auth.py +++ b/core/admin/mailu/internal/views/auth.py @@ -50,7 +50,7 @@ def user_authentication(): if (not flask_login.current_user.is_anonymous and flask_login.current_user.enabled): response = flask.Response() - response.headers["X-User"] = flask_login.current_user.get_id() + response.headers["X-User"] = models.IdnaEmail.process_bind_param(flask_login, flask_login.current_user.get_id(), "") response.headers["X-User-Token"] = models.User.get_temp_token(flask_login.current_user.get_id()) return response return flask.abort(403) @@ -67,7 +67,7 @@ def basic_authentication(): user = models.User.query.get(user_email.decode("utf8")) if nginx.check_credentials(user, password.decode('utf-8'), flask.request.remote_addr, "web"): response = flask.Response() - response.headers["X-User"] = user.email + response.headers["X-User"] = models.IdnaEmail.process_bind_param(flask_login, user.email, "") return response response = flask.Response(status=401) response.headers["WWW-Authenticate"] = 'Basic realm="Login Required"'
[master] webmail page returns HTTP500 error when domain name contains an umlaut. ## Environment & Versions ### Environment - [x] docker-compose - [ ] kubernetes - [ ] docker swarm ### Versions master ## Description Webmail cannot be accessed when the domain name contains an umlaut. It does not matter if you login with the normal name or ACE notation (exรคmple.io vs xn--exmple-cua.io) ## Replication Steps 1). On test.mailu.io I created domain exรคmple.io . 2). Create user1 on this domain exรคmple. 3). Try going to webmail as user1@exรคmple.io. HTTP500 error. Admin page is accessible. 4). Try going to webmail as [email protected]. Admin page is accessible. HTTP500 error for webmail. 1). On test.mailu.io I created domain xn--exmple-cua.io . After adding the domain, I noted that the domains page nicely shows exรคmple as the domain name. 2). Create user1 on this domain exรคmple. 3). Try going to webmail as user1@exรคmple.io. HTTP500 error. Admin page is accessible. 4). Try going to webmail as [email protected]. Admin page is accessible. HTTP500 error for webmail. ## Expected behaviour Webmail is reachable. ## Logs webmail no errors. Possibly the logging is not correctly configured? ``` webmail_1 | 192.168.203.5 - - [26/Aug/2021:11:34:46 +0000] "POST /?_task=mail&_action=refresh HTTP/1.1" 200 620 "https://test.mailu.io/webmail/?_task=mail&_mbox=INBOX" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36" webmail_1 | 127.0.0.1 - - [26/Aug/2021:11:35:04 +0000] "GET / HTTP/1.1" 302 577 "-" "curl/7.74.0" ``` front. Maybe the error "*5228 auth request unexpected status: 500 while sending to client," is relevant? ``` front_1 | 2021/08/26 11:37:41 [error] 13#13: *5228 auth request unexpected status: 500 while sending to client, client: 172.18.0.2, server: , request: "GET /webmail/ HTTP/1.1", host: "test.mailu.io", referrer: "https://test.mailu.io/admin/ui/user/settings" front_1 | 172.18.0.2 - - [26/Aug/2021:11:37:41 +0000] "GET /webmail/ HTTP/1.1" 500 170 "https://test.mailu.io/admin/ui/user/settings" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" front_1 | 2021/08/26 11:37:43 [info] 13#13: *6413 client 87.246.7.228:64784 connected to 0.0.0.0:25 front_1 | 2021/08/26 11:37:43 [error] 13#13: *6413 "net6-ip228.linkbg.com" could not be resolved (3: Host not found) while in resolving client hostname, client: 87.246.7.228, server: 0.0.0.0:25 front_1 | 2021/08/26 11:37:46 [info] 13#13: *6417 client 192.168.203.12:43612 connected to 0.0.0.0:10143 front_1 | 127.0.0.1 - - [26/Aug/2021:11:37:46 +0000] "GET /auth/email HTTP/1.0" 200 0 "-" "-" front_1 | 2021/08/26 11:37:46 [info] 13#13: *6417 client logged in, client: 192.168.203.12, server: 0.0.0.0:10143, login: "[email protected]", upstream: 192.168.203.7:143 front_1 | 2021/08/26 11:37:46 [info] 13#13: *6417 proxied session done, client: 192.168.203.12, server: 0.0.0.0:10143, login: "[email protected]", upstream: 192.168.203.7:143 front_1 | 172.18.0.2 - - [26/Aug/2021:11:37:46 +0000] "POST /webmail/?_task=mail&_action=refresh HTTP/1.1" 200 124 "https://test.mailu.io/webmail/?_task=mail&_mbox=INBOX" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36" front_1 | 2021/08/26 11:37:46 [info] 13#13: *6409 client login failed: "AUTH not supported" while in http auth state, client: 212.70.149.88, server: 0.0.0.0:25, login: "[email protected]" front_1 | 127.0.0.1 - - [26/Aug/2021:11:37:46 +0000] "GET /auth/email HTTP/1.0" 200 0 "-" "-" front_1 | 127.0.0.1 - - [26/Aug/2021:11:37:47 +0000] "GET /auth/email HTTP/1.0" 200 0 "-" "-" front_1 | 2021/08/26 11:37:47 [info] 13#13: *6410 client login failed: "AUTH not supported" while in http auth state, client: 87.246.7.245, server: 0.0.0.0:25, login: "[email protected]" front_1 | 127.0.0.1 - - [26/Aug/2021:11:37:50 +0000] "GET /auth/email HTTP/1.0" 200 0 "-" "-" front_1 | 2021/08/26 11:37:50 [info] 13#13: *6411 client login failed: "AUTH not supported" while in http auth state, client: 212.70.149.56, server: 0.0.0.0:25, login: "[email protected]" front_1 | 127.0.0.1 - - [26/Aug/2021:11:37:51 +0000] "GET /auth/email HTTP/1.0" 200 0 "-" "-" ``` admin ``` admin_1 | 127.0.0.1 - - [26/Aug/2021:11:38:38 +0000] "GET /ui/login?next=ui.index HTTP/1.1" 200 3745 "-" "curl/7.78.0" admin_1 | 192.168.203.5 - - [26/Aug/2021:11:38:39 +0000] "GET /internal/auth/email HTTP/1.0" 200 0 "-" "-" admin_1 | 206.190.233.240 - - [26/Aug/2021:11:38:45 +0000] "GET /internal/auth/user HTTP/1.0" 200 0 "https://test.mailu.io/webmail/?_task=mail&_mbox=INBOX" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36" admin_1 | 192.168.203.5 - - [26/Aug/2021:11:38:46 +0000] "GET /internal/auth/email HTTP/1.0" 200 0 "-" "-" admin_1 | 192.168.203.7 - - [26/Aug/2021:11:38:46 +0000] "GET /internal/dovecot/passdb/[email protected] HTTP/1.1" 200 67 "-" "Python/3.9 aiohttp/3.7.4.post0" admin_1 | 192.168.203.7 - - [26/Aug/2021:11:38:46 +0000] "GET /internal/dovecot/userdb/[email protected] HTTP/1.1" 200 36 "-" "Python/3.9 aiohttp/3.7.4.post0" admin_1 | 192.168.203.5 - - [26/Aug/2021:11:38:47 +0000] "GET /internal/auth/email HTTP/1.0" 200 0 "-" "-" admin_1 | 192.168.203.5 - - [26/Aug/2021:11:38:48 +0000] "GET /internal/auth/email HTTP/1.0" 200 0 "-" "-" admin_1 | 192.168.203.5 - - [26/Aug/2021:11:38:51 +0000] "GET /internal/auth/email HTTP/1.0" 200 0 "-" "-" admin_1 | 192.168.203.5 - - [26/Aug/2021:11:38:52 +0000] "GET /internal/auth/email HTTP/1.0" 200 0 "-" "-" admin_1 | 192.168.203.5 - - [26/Aug/2021:11:39:05 +0000] "GET /internal/auth/email HTTP/1.0" 200 0 "-" "-" admin_1 | 192.168.203.5 - - [26/Aug/2021:11:39:08 +0000] "GET /internal/auth/email HTTP/1.0" 200 0 "-" "-" admin_1 | 127.0.0.1 - - [26/Aug/2021:11:39:09 +0000] "GET /ui/login?next=ui.index HTTP/1.1" 200 3745 "-" "curl/7.78.0" admin_1 | 192.168.203.5 - - [26/Aug/2021:11:39:12 +0000] "GET /internal/auth/email HTTP/1.0" 200 0 "-" "-" admin_1 | 192.168.203.5 - - [26/Aug/2021:11:39:14 +0000] "GET /internal/auth/email HTTP/1.0" 200 0 "-" "-" admin_1 | 192.168.203.5 - - [26/Aug/2021:11:39:23 +0000] "GET /internal/auth/email HTTP/1.0" 200 0 "-" "-" admin_1 | 192.168.203.5 - - [26/Aug/2021:11:39:28 +0000] "GET /internal/auth/email HTTP/1.0" 200 0 "-" "-" admin_1 | 192.168.203.5 - - [26/Aug/2021:11:39:32 +0000] "GET /internal/auth/email HTTP/1.0" 200 0 "-" "-" admin_1 | 192.168.203.5 - - [26/Aug/2021:11:39:36 +0000] "GET /internal/auth/email HTTP/1.0" 200 0 "-" "-" admin_1 | 127.0.0.1 - - [26/Aug/2021:11:39:39 +0000] "GET /ui/login?next=ui.index HTTP/1.1" 200 3745 "-" "curl/7.78.0" admin_1 | 192.168.203.5 - - [26/Aug/2021:11:39:43 +0000] "GET /internal/auth/email HTTP/1.0" 200 0 "-" "-" admin_1 | 206.190.233.240 - - [26/Aug/2021:11:39:45 +0000] "GET /internal/auth/user HTTP/1.0" 200 0 "https://test.mailu.io/webmail/?_task=mail&_mbox=INBOX" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36" admin_1 | 192.168.203.5 - - [26/Aug/2021:11:39:46 +0000] "GET /internal/auth/email HTTP/1.0" 200 0 "-" "-" admin_1 | 192.168.203.7 - - [26/Aug/2021:11:39:46 +0000] "GET /internal/dovecot/passdb/[email protected] HTTP/1.1" 200 67 "-" "Python/3.9 aiohttp/3.7.4.post0" admin_1 | 192.168.203.7 - - [26/Aug/2021:11:39:46 +0000] "GET /internal/dovecot/userdb/[email protected] HTTP/1.1" 200 36 "-" "Python/3.9 aiohttp/3.7.4.post0" admin_1 | 192.168.203.5 - - [26/Aug/2021:11:39:48 +0000] "GET /internal/auth/email HTTP/1.0" 200 0 "-" "-" admin_1 | 192.168.203.5 - - [26/Aug/2021:11:39:53 +0000] "GET /internal/auth/email HTTP/1.0" 200 0 "-" "-" ```
Again the logs with the same time range admin: ``` admin_1 | 172.18.0.2 - - [26/Aug/2021:12:08:17 +0000] "GET /ui/ HTTP/1.1" 302 265 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" admin_1 | 172.18.0.2 - - [26/Aug/2021:12:08:17 +0000] "GET /ui/login?next=ui.index HTTP/1.1" 200 3781 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" admin_1 | 192.168.203.5 - - [26/Aug/2021:12:08:17 +0000] "GET /internal/auth/email HTTP/1.0" 200 0 "-" "-" admin_1 | 172.18.0.2 - - [26/Aug/2021:12:08:17 +0000] "GET /ui/static/app.css HTTP/1.1" 200 0 "https://test.mailu.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" admin_1 | 127.0.0.1 - - [26/Aug/2021:12:08:20 +0000] "GET /ui/login?next=ui.index HTTP/1.1" 200 3745 "-" "curl/7.78.0" admin_1 | 192.168.203.5 - - [26/Aug/2021:12:08:20 +0000] "GET /internal/auth/email HTTP/1.0" 200 0 "-" "-" admin_1 | 172.18.0.2 - - [26/Aug/2021:12:08:24 +0000] "POST /ui/login?next=ui.index HTTP/1.1" 302 227 "https://test.mailu.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" admin_1 | 172.18.0.2 - - [26/Aug/2021:12:08:24 +0000] "GET /ui/ HTTP/1.1" 302 253 "https://test.mailu.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" admin_1 | 172.18.0.2 - - [26/Aug/2021:12:08:24 +0000] "GET /ui/user/settings HTTP/1.1" 200 7182 "https://test.mailu.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" admin_1 | [2021-08-26 12:08:27 +0000] [10] [ERROR] Error handling request /internal/auth/user admin_1 | Traceback (most recent call last): admin_1 | File "/usr/lib/python3.9/site-packages/gunicorn/workers/gthread.py", line 279, in handle admin_1 | keepalive = self.handle_request(req, conn) admin_1 | File "/usr/lib/python3.9/site-packages/gunicorn/workers/gthread.py", line 336, in handle_request admin_1 | resp.close() admin_1 | File "/usr/lib/python3.9/site-packages/gunicorn/http/wsgi.py", line 409, in close admin_1 | self.send_headers() admin_1 | File "/usr/lib/python3.9/site-packages/gunicorn/http/wsgi.py", line 329, in send_headers admin_1 | util.write(self.sock, util.to_bytestring(header_str, "ascii")) admin_1 | File "/usr/lib/python3.9/site-packages/gunicorn/util.py", line 507, in to_bytestring admin_1 | return value.encode(encoding) admin_1 | UnicodeEncodeError: 'ascii' codec can't encode character '\xe4' in position 154: ordinal not in range(128) admin_1 | 192.168.203.5 - - [26/Aug/2021:12:08:27 +0000] "GET /internal/auth/user HTTP/1.0" 500 0 "-" "-" admin_1 | 192.168.203.5 - - [26/Aug/2021:12:08:31 +0000] "GET /internal/auth/email HTTP/1.0" 200 0 "-" "-" admin_1 | 192.168.203.5 - - [26/Aug/2021:12:08:34 +0000] "GET /internal/auth/email HTTP/1.0" 200 0 "-" "-" admin_1 | 192.168.203.5 - - [26/Aug/2021:12:08:34 +0000] "GET /internal/auth/email HTTP/1.0" 200 0 "-" "-" ``` webmail: ``` webmail_1 | 127.0.0.1 - - [26/Aug/2021:12:08:07 +0000] "GET /sso.php HTTP/1.1" 302 577 "-" "curl/7.74.0" webmail_1 | 127.0.0.1 - - [26/Aug/2021:12:08:38 +0000] "GET / HTTP/1.1" 302 577 "-" "curl/7.74.0" webmail_1 | 127.0.0.1 - - [26/Aug/2021:12:08:38 +0000] "GET /sso.php HTTP/1.1" 302 577 "-" "curl/7.74.0" webmail_1 | 127.0.0.1 - - [26/Aug/2021:12:08:38 +0000] "GET /sso.php HTTP/1.1" 302 577 "-" "curl/7.74.0" webmail_1 | 127.0.0.1 - - [26/Aug/2021:12:08:38 +0000] "GET /sso.php HTTP/1.1" 302 577 "-" "curl/7.74.0" webmail_1 | 127.0.0.1 - - [26/Aug/2021:12:08:39 +0000] "GET /sso.php HTTP/1.1" 302 577 "-" "curl/7.74.0" webmail_1 | 127.0.0.1 - - [26/Aug/2021:12:08:39 +0000] "GET /sso.php HTTP/1.1" 302 577 "-" "curl/7.74.0" webmail_1 | 127.0.0.1 - - [26/Aug/2021:12:08:39 +0000] "GET /sso.php HTTP/1.1" 302 577 "-" "curl/7.74.0" webmail_1 | 127.0.0.1 - - [26/Aug/2021:12:08:40 +0000] "GET /sso.php HTTP/1.1" 302 577 "-" "curl/7.74.0" webmail_1 | 127.0.0.1 - - [26/Aug/2021:12:08:40 +0000] "GET /sso.php HTTP/1.1" 302 577 "-" "curl/7.74.0" webmail_1 | 127.0.0.1 - - [26/Aug/2021:12:08:40 +0000] "GET /sso.php HTTP/1.1" 302 577 "-" "curl/7.74.0" webmail_1 | 127.0.0.1 - - [26/Aug/2021:12:08:41 +0000] "GET /sso.php HTTP/1.1" 302 577 "-" "curl/7.74.0" webmail_1 | 127.0.0.1 - - [26/Aug/2021:12:08:41 +0000] "GET /sso.php HTTP/1.1" 302 577 "-" "curl/7.74.0" webmail_1 | 127.0.0.1 - - [26/Aug/2021:12:08:41 +0000] "GET /sso.php HTTP/1.1" 302 577 "-" "curl/7.74.0" webmail_1 | 127.0.0.1 - - [26/Aug/2021:12:08:42 +0000] "GET /sso.php HTTP/1.1" 302 577 "-" "curl/7.74.0" webmail_1 | 127.0.0.1 - - [26/Aug/2021:12:08:42 +0000] "GET /sso.php HTTP/1.1" 302 577 "-" "curl/7.74.0" webmail_1 | 127.0.0.1 - - [26/Aug/2021:12:08:42 +0000] "GET /sso.php HTTP/1.1" 302 577 "-" "curl/7.74.0" webmail_1 | 127.0.0.1 - - [26/Aug/2021:12:08:43 +0000] "GET /sso.php HTTP/1.1" 302 577 "-" "curl/7.74.0" webmail_1 | 127.0.0.1 - - [26/Aug/2021:12:08:43 +0000] "GET /sso.php HTTP/1.1" 302 577 "-" "curl/7.74.0" webmail_1 | 127.0.0.1 - - [26/Aug/2021:12:08:43 +0000] "GET /sso.php HTTP/1.1" 302 577 "-" "curl/7.74.0" webmail_1 | 127.0.0.1 - - [26/Aug/2021:12:08:44 +0000] "GET /sso.php HTTP/1.1" 302 577 "-" "curl/7.74.0" webmail_1 | 127.0.0.1 - - [26/Aug/2021:12:08:44 +0000] "GET /sso.php HTTP/1.1" 302 577 "-" "curl/7.74.0" webmail_1 | 127.0.0.1 - - [26/Aug/2021:12:08:44 +0000] "GET /sso.php HTTP/1.1" 302 577 "-" "curl/7.74.0" webmail_1 | 127.0.0.1 - - [26/Aug/2021:12:08:44 +0000] "GET /sso.php HTTP/1.1" 302 577 "-" "curl/7.74.0" webmail_1 | 127.0.0.1 - - [26/Aug/2021:12:08:45 +0000] "GET /sso.php HTTP/1.1" 302 577 "-" "curl/7.74.0" webmail_1 | 127.0.0.1 - - [26/Aug/2021:12:08:45 +0000] "GET /sso.php HTTP/1.1" 302 577 "-" "curl/7.74.0" webmail_1 | 127.0.0.1 - - [26/Aug/2021:12:08:46 +0000] "GET /sso.php HTTP/1.1" 302 577 "-" "curl/7.74.0" webmail_1 | 192.168.203.5 - - [26/Aug/2021:12:08:45 +0000] "POST /?_task=mail&_action=refresh HTTP/1.1" 200 620 "https://test.mailu.io/webmail/?_task=mail&_mbox=INBOX" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36" webmail_1 | 127.0.0.1 - - [26/Aug/2021:12:08:46 +0000] "GET /sso.php HTTP/1.1" 302 577 "-" "curl/7.74.0" webmail_1 | 127.0.0.1 - - [26/Aug/2021:12:08:47 +0000] "GET /sso.php HTTP/1.1" 302 577 "-" "curl/7.74.0" ``` front: ``` front_1 | 127.0.0.1 - - [26/Aug/2021:12:08:14 +0000] "GET /auth/email HTTP/1.0" 200 0 "-" "-" front_1 | 2021/08/26 12:08:14 [info] 13#13: *8261 client login failed: "AUTH not supported" while in http auth state, client: 212.70.149.56, server: 0.0.0.0:25, login: "[email protected]" front_1 | 172.18.0.2 - - [26/Aug/2021:12:08:17 +0000] "GET /admin/ HTTP/1.1" 301 162 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" front_1 | 172.18.0.2 - - [26/Aug/2021:12:08:17 +0000] "GET /admin/ui/ HTTP/1.1" 302 265 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" front_1 | 172.18.0.2 - - [26/Aug/2021:12:08:17 +0000] "GET /admin/ui/login?next=ui.index HTTP/1.1" 200 3781 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" front_1 | 127.0.0.1 - - [26/Aug/2021:12:08:17 +0000] "GET /auth/email HTTP/1.0" 200 0 "-" "-" front_1 | 2021/08/26 12:08:17 [info] 13#13: *8263 client login failed: "AUTH not supported" while in http auth state, client: 87.246.7.245, server: 0.0.0.0:25, login: "[email protected]" front_1 | 172.18.0.2 - - [26/Aug/2021:12:08:17 +0000] "GET /admin/ui/static/app.css HTTP/1.1" 200 322 "https://test.mailu.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" front_1 | 2021/08/26 12:08:20 [info] 13#13: *8246 client login failed: "Authentication credentials invalid" while in http auth state, client: 212.70.149.71, server: 0.0.0.0:465, login: "[email protected]" front_1 | 127.0.0.1 - - [26/Aug/2021:12:08:20 +0000] "GET /auth/email HTTP/1.0" 200 0 "-" "-" front_1 | 2021/08/26 12:08:23 [info] 13#13: *8283 client 87.246.7.228:64408 connected to 0.0.0.0:25 front_1 | 2021/08/26 12:08:23 [error] 13#13: *8283 "net6-ip228.linkbg.com" could not be resolved (3: Host not found) while in resolving client hostname, client: 87.246.7.228, server: 0.0.0.0:25 front_1 | 172.18.0.2 - - [26/Aug/2021:12:08:24 +0000] "POST /admin/ui/login?next=ui.index HTTP/1.1" 302 227 "https://test.mailu.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" front_1 | 172.18.0.2 - - [26/Aug/2021:12:08:24 +0000] "GET /admin/ui/ HTTP/1.1" 302 253 "https://test.mailu.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" front_1 | 172.18.0.2 - - [26/Aug/2021:12:08:24 +0000] "GET /admin/ui/user/settings HTTP/1.1" 200 7182 "https://test.mailu.io/admin/ui/login?next=ui.index" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" front_1 | 2021/08/26 12:08:25 [info] 13#13: *7066 sendfile() failed (32: Broken pipe) while sending response to client, client: 172.18.0.2, server: , request: "GET /favicon.ico HTTP/1.1", host: "test.mailu.io", referrer: "https://test.mailu.io/admin/ui/user/settings" front_1 | 172.18.0.2 - - [26/Aug/2021:12:08:25 +0000] "GET /favicon.ico HTTP/1.1" 200 0 "https://test.mailu.io/admin/ui/user/settings" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" front_1 | 2021/08/26 12:08:25 [info] 13#13: *8287 client 212.70.149.88:26708 connected to 0.0.0.0:25 front_1 | 2021/08/26 12:08:25 [error] 13#13: *8287 212.70.149.88 could not be resolved (3: Host not found) while in resolving client address, client: 212.70.149.88, server: 0.0.0.0:25 front_1 | 2021/08/26 12:08:25 [info] 13#13: *8288 client 212.70.149.56:52312 connected to 0.0.0.0:25 front_1 | 2021/08/26 12:08:25 [error] 13#13: *8288 212.70.149.56 could not be resolved (3: Host not found) while in resolving client address, client: 212.70.149.56, server: 0.0.0.0:25 front_1 | 2021/08/26 12:08:27 [info] 13#13: *8289 client 172.18.0.2 closed keepalive connection front_1 | 172.18.0.2 - - [26/Aug/2021:12:08:27 +0000] "GET /webmail HTTP/1.1" 301 162 "https://test.mailu.io/admin/ui/user/settings" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" front_1 | 172.18.0.2 - - [26/Aug/2021:12:08:27 +0000] "GET /webmail/ HTTP/1.1" 500 170 "https://test.mailu.io/admin/ui/user/settings" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" front_1 | 2021/08/26 12:08:27 [error] 13#13: *8290 auth request unexpected status: 500 while sending to client, client: 172.18.0.2, server: , request: "GET /webmail/ HTTP/1.1", host: "test.mailu.io", referrer: "https://test.mailu.io/admin/ui/user/settings" front_1 | 2021/08/26 12:08:29 [info] 13#13: *8292 client 87.246.7.245:54410 connected to 0.0.0.0:25 front_1 | 2021/08/26 12:08:29 [error] 13#13: *8292 "ip245.tervelnet.com" could not be resolved (3: Host not found) while in resolving client hostname, client: 87.246.7.245, server: 0.0.0.0:25 front_1 | 127.0.0.1 - - [26/Aug/2021:12:08:31 +0000] "GET /auth/email HTTP/1.0" 200 0 "-" "-" front_1 | 2021/08/26 12:08:31 [info] 13#13: *8283 client login failed: "AUTH not supported" while in http auth state, client: 87.246.7.228, server: 0.0.0.0:25, login: "[email protected]" front_1 | 2021/08/26 12:08:34 [info] 13#13: *8287 client login failed: "AUTH not supported" while in http auth state, client: 212.70.149.88, server: 0.0.0.0:25, login: "[email protected]" front_1 | 127.0.0.1 - - [26/Aug/2021:12:08:34 +0000] "GET /auth/email HTTP/1.0" 200 0 "-" "-" front_1 | 127.0.0.1 - - [26/Aug/2021:12:08:34 +0000] "GET /auth/email HTTP/1.0" 200 0 "-" "-" front_1 | 2021/08/26 12:08:34 [info] 13#13: *8288 client login failed: "AUTH not supported" while in http auth state, client: 212.70.149.56, server: 0.0.0.0:25, login: "[email protected]" front_1 | 127.0.0.1 - - [26/Aug/2021:12:08:37 +0000] "GET /auth/email HTTP/1.0" 200 0 "-" "-" front_1 | 2021/08/26 12:08:37 [info] 13#13: *8292 client login failed: "AUTH not supported" while in http auth state, client: 87.246.7.245, server: 0.0.0.0:25, login: "[email protected]" front_1 | 127.0.0.1 - - [26/Aug/2021:12:08:41 +0000] "GET /health HTTP/1.1" 204 0 "-" "curl/7.78.0" front_1 | 2021/08/26 12:08:41 [info] 13#13: *8305 client 127.0.0.1 closed keepalive connection ``` The error refers to https://github.com/Mailu/Mailu/blob/ecb39fed04b6ec4d486556044ccaf2102cde6196/core/admin/mailu/internal/views/auth.py#L52 . It complains about the รค. Only ASCII is allowed in HTTP headers. In auth.py we add the full username as a header (localpart@domain). A solution would be to base64 encode the user name. In the php (in roundcube/rainloop?) decode the base64 encoded username in the HTTP header.
2021-08-27T08:33:50
Mailu/Mailu
1,968
Mailu__Mailu-1968
[ "1361" ]
71cc8b0a81158afc54283a9b62dc1618e3c259d1
diff --git a/core/admin/mailu/internal/nginx.py b/core/admin/mailu/internal/nginx.py --- a/core/admin/mailu/internal/nginx.py +++ b/core/admin/mailu/internal/nginx.py @@ -71,16 +71,6 @@ def handle_authentication(headers): } # Authenticated user elif method == "plain": - server, port = get_server(headers["Auth-Protocol"], True) - # According to RFC2616 section 3.7.1 and PEP 3333, HTTP headers should - # be ASCII and are generally considered ISO8859-1. However when passing - # the password, nginx does not transcode the input UTF string, thus - # we need to manually decode. - raw_user_email = urllib.parse.unquote(headers["Auth-User"]) - user_email = raw_user_email.encode("iso8859-1").decode("utf8") - raw_password = urllib.parse.unquote(headers["Auth-Pass"]) - password = raw_password.encode("iso8859-1").decode("utf8") - ip = urllib.parse.unquote(headers["Client-Ip"]) service_port = int(urllib.parse.unquote(headers["Auth-Port"])) if service_port == 25: return { @@ -88,20 +78,33 @@ def handle_authentication(headers): "Auth-Error-Code": "502 5.5.1", "Auth-Wait": 0 } - user = models.User.query.get(user_email) - if check_credentials(user, password, ip, protocol): - return { - "Auth-Status": "OK", - "Auth-Server": server, - "Auth-Port": port - } + # According to RFC2616 section 3.7.1 and PEP 3333, HTTP headers should + # be ASCII and are generally considered ISO8859-1. However when passing + # the password, nginx does not transcode the input UTF string, thus + # we need to manually decode. + raw_user_email = urllib.parse.unquote(headers["Auth-User"]) + raw_password = urllib.parse.unquote(headers["Auth-Pass"]) + try: + user_email = raw_user_email.encode("iso8859-1").decode("utf8") + password = raw_password.encode("iso8859-1").decode("utf8") + except: + app.logger.warn(f'Received undecodable user/password from nginx: {raw_user_email!r}/{raw_password!r}') else: - status, code = get_status(protocol, "authentication") - return { - "Auth-Status": status, - "Auth-Error-Code": code, - "Auth-Wait": 0 - } + user = models.User.query.get(user_email) + ip = urllib.parse.unquote(headers["Client-Ip"]) + if check_credentials(user, password, ip, protocol): + server, port = get_server(headers["Auth-Protocol"], True) + return { + "Auth-Status": "OK", + "Auth-Server": server, + "Auth-Port": port + } + status, code = get_status(protocol, "authentication") + return { + "Auth-Status": status, + "Auth-Error-Code": code, + "Auth-Wait": 0 + } # Unexpected return {}
Insufficient input validation in /internal endpoint It seems like it is possible to crash a thread of flask by sending an invalid utf-8 username. As far as i can see, this can not be used to gain access (should be validated). Here are logs to reproduce this. [error] 56#56: *1312970 auth http server 127.0.0.1:8000 did not send server or port while in http auth state, client: xx.xx.xx.xx, server: 0.0.0.0:25, login: "xxxxxxxxx\[email protected]" GET /internal/auth/email HTTP/1.0" 500 290 "-" "-" ERROR in app: Exception on /internal/auth/email [GET] Traceback (most recent call last): File "/usr/lib/python3.7/site-packages/flask/app.py", line 2292, in wsgi_app response = self.full_dispatch_request() File "/usr/lib/python3.7/site-packages/flask/app.py", line 1815, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/lib/python3.7/site-packages/flask/app.py", line 1718, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/lib/python3.7/site-packages/flask/_compat.py", line 35, in reraise raise value File "/usr/lib/python3.7/site-packages/flask/app.py", line 1813, in full_dispatch_request rv = self.dispatch_request() File "/usr/lib/python3.7/site-packages/flask/app.py", line 1799, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/usr/lib/python3.7/site-packages/flask_limiter/extension.py", line 544, in __inner return obj(*a, **k) File "/app/mailu/internal/views/auth.py", line 18, in nginx_authentication headers = nginx.handle_authentication(flask.request.headers) File "/app/mailu/internal/nginx.py", line 45, in handle_authentication user_email = raw_user_email.encode("iso8859-1").decode("utf8") UnicodeDecodeError: 'utf-8' codec can't decode byte 0xed in position 6: invalid continuation byte xx.xx.xx.xx - - [xx/xx/xxxx:xx:xx:xx +0000] "GET /internal/auth/email HTTP/1.0" 500 290 "-" "-"
Thank you for reporting. I confirm this cannot be used to gain access. Did you encounter this during normal use of Mailu? If not I am in favor of just dropping non-utf8 usernames I get this a few times a day. In fact this report is a real case. I don't want to drop any usernames at all, maybe better errorhandling is a solution? UnicodeDecodeError is a quite explicit exception. catch it and return a 404? Yep, probably the best fix :) Hi There, The `Mailu`-Project is currently in a bit of a bind! We are short on man-power, and we need to judge if it is possible for us to put in some work on this issue. To help with that, we are currently trying to find out which issues are actively keeping users from using `Mailu`, which issues have someone who want to work on them โ€” and which issues may be less important. These a less important ones could be discarded for the time being, until the project is in a more stable and regular state once again. In order for us to better assess this, it would be helpful if you could put a **reaction on this post** (use the :smiley: icon to the top-right). - ๐Ÿ‘๏ธ if you **need this** to be able to use Mailu. Ideally, youโ€™d also be able to test this on your installation, and provide feedback โ€ฆ - ๐ŸŽ‰ if you find it a **nice bonus**, but no deal-breaker - ๐Ÿš€ if you want to **work on it yourself**! We want to keep this **voting open for 2 weeks** from now, so please help out! This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Why stale-bot is targeting this? This is a bug and should be resolved sometime. Just closing does not fix the issue I get that error quite often too BTW. Any chance we could address it?
2021-09-05T17:55:00
Mailu/Mailu
1,974
Mailu__Mailu-1974
[ "1973" ]
d4641874773372f6a62017e37f5643abadc6aede
diff --git a/core/postfix/start.py b/core/postfix/start.py --- a/core/postfix/start.py +++ b/core/postfix/start.py @@ -77,7 +77,8 @@ def is_valid_postconf_line(line): if os.path.exists("/overrides/mta-sts-daemon.yml"): shutil.copyfile("/overrides/mta-sts-daemon.yml", "/etc/mta-sts-daemon.yml") -conf.jinja("/etc/mta-sts-daemon.yml", os.environ, "/etc/mta-sts-daemon.yml") +else: + conf.jinja("/conf/mta-sts-daemon.yml", os.environ, "/etc/mta-sts-daemon.yml") if not os.path.exists("/etc/postfix/tls_policy.map.lmdb"): open("/etc/postfix/tls_policy.map", "a").close()
DEFER_ON_TLS_ERROR in mailu.env doesn't appear to be applied. Thank you for opening an issue with Mailu. Please understand that issues are meant for bugs and enhancement-requests. For **user-support questions**, reach out to us on [matrix](https://matrix.to/#/#mailu:tedomum.net). To be able to help you best, we need some more information. ## Before you open your issue - [X] Check if no issue or pull-request for this already exists. - [X] Check [documentation](https://mailu.io/master/) and [FAQ](https://mailu.io/master/faq.html). (Tip, use the search function on the documentation page) - [X] You understand `Mailu` is made by volunteers in their **free time** โ€” be conscise, civil and accept that delays can occur. - [X] The title of the issue should be short and simple. It should contain specific terms related to the actual issue. Be specific while writing the title. ## Environment & Versions ### Environment - [X] docker-compose - [ ] kubernetes - [ ] docker swarm ### Versions master (d464187) ## Description DEFER_ON_TLS_ERROR in mailu.env doesn't appear to be applied. I've set this environment variable to "false" and my emails still appear to be deferred according to the SMTP container. `(status=deferred (client TLS configuration problem))` I've set this to "false" because MTA-STS isn't as widely deployed as one would hope, and I don't want my emails blackholed and deferred until my destination's policy is published (which may be never)... ## Replication Steps In mailu.env - set `DEFER_ON_TLS_ERROR=false`, reload containers, then try sending an email to a domain without an MTA-STS policy... Then output logs for the SMTP container and note the message deferral. ## Expected behaviour I expect the email to continue being sent despite the MTA-STS error. ## Logs ``` smtp_1 | Sep 09 13:42:08 mail postfix/cleanup[416]: 85B6147DDA: message-id=<[email protected]> smtp_1 | Sep 09 13:42:09 mail postfix/qmgr[391]: 85B6147DDA: from=<[email protected]>, size=6074, nrcpt=1 (queue active) smtp_1 | Sep 09 13:42:09 mail postfix/smtp[417]: warning: connect to /tmp/mta-sts.socket: No such file or directory smtp_1 | Sep 09 13:42:09 mail postfix/smtp[417]: warning: table socketmap:unix:/tmp/mta-sts.socket:postfix lookup error: No such file or directory smtp_1 | Sep 09 13:42:09 mail postfix/smtp[417]: warning: socketmap:unix:/tmp/mta-sts.socket:postfix lookup error for "ssl-tools.net" smtp_1 | Sep 09 13:42:09 mail postfix/smtp[417]: warning: smtp_tls_policy_maps, next-hop destination "ssl-tools.net": policy table lookup error smtp_1 | Sep 09 13:42:09 mail postfix/smtp[417]: warning: TLS policy lookup for ssl-tools.net/ssl-tools.net: client TLS configuration problem smtp_1 | Sep 09 13:42:09 mail postfix/smtp[417]: warning: TLS policy lookup for ssl-tools.net/ssl-tools.net: client TLS configuration problem smtp_1 | Sep 09 13:42:09 mail postfix/smtp[417]: 85B6147DDA: to=<[email protected]>, relay=none, delay=1.1, delays=1/0.03/0.01/0, dsn=4.7.5, status=deferred (client TLS configuration problem) ```
2021-09-09T16:03:43
Mailu/Mailu
1,989
Mailu__Mailu-1989
[ "1988", "1988" ]
4c5c6c3b5fd2d6165bdfa460d48a302be766fdc7
diff --git a/core/admin/mailu/utils.py b/core/admin/mailu/utils.py --- a/core/admin/mailu/utils.py +++ b/core/admin/mailu/utils.py @@ -58,7 +58,7 @@ def has_dane_record(domain, timeout=10): # we will receive this non-specific exception. The safe behaviour is to # accept to defer the email. flask.current_app.logger.warn(f'Unable to lookup the TLSA record for {domain}. Is the DNSSEC zone okay on https://dnsviz.net/d/{domain}/dnssec/?') - return app.config['DEFER_ON_TLS_ERROR'] + return flask.current_app.config['DEFER_ON_TLS_ERROR'] except dns.exception.Timeout: flask.current_app.logger.warn(f'Timeout while resolving the TLSA record for {domain} ({timeout}s).') except dns.resolver.NXDOMAIN:
Mail Rejected/Failed to Send to Relay HOST - DANE exceptions in ADMIN, Similar in POSTFIX Thank you for opening an issue with Mailu. Please understand that issues are meant for bugs and enhancement-requests. For **user-support questions**, reach out to us on [matrix](https://matrix.to/#/#mailu:tedomum.net). To be able to help you best, we need some more information. ## Before you open your issue - [ X] Check if no issue or pull-request for this already exists. - [ ] Check [documentation](https://mailu.io/master/) and [FAQ](https://mailu.io/master/faq.html). (Tip, use the search function on the documentation page) - [ ] You understand `Mailu` is made by volunteers in their **free time** โ€” be conscise, civil and accept that delays can occur. - [ ] The title of the issue should be short and simple. It should contain specific terms related to the actual issue. Be specific while writing the title. ## Environment & Versions ### Environment - [ ] docker-compose - [ X] kubernetes - [ ] docker swarm ### Versions To find your version, get the image name of a mailu container and read the version from the tag (example for version 1.7). ``` $> docker ps -a | grep mailu 140b09d4b09c mailu/roundcube:1.7 "docker-php-entrypoiโ€ฆ" 2 weeks ago Up 2 days (healthy) 80/tcp $> grep MAILU_VERSION docker-compose.yml mailu.env ``` LATEST VERSION (from helm chart) ## Description Further explain the bug in a few words. It should be clear what the unexpected behaviour is. Share it in an easy-to-understand language. We are sending mail to mailu, this was working with our configuration for about 1 year so far, during a recent K8s upgrade and following, we see that pod were redployed and now we see the errors in the logs when we are doing the same STARTTLS submit to the mail server that we have been doing prior ## Replication Steps No idea, update the mailu to the latest release and that is what we saw ## Expected behaviour the mail to work ## Logs Here is the log from the ADMIN component, you can see its throwing an exception, we did the dig and nsloookup on the pod and there is no issues resoving the host, we did NETCAT and can connect from the ADMIN pod and the POSTFIX PODS and can do submit over netcat (command line ELHO/HELO, etc) ADMIN LOG During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3.9/site-packages/flask/app.py", line 2292, in wsgi_app response = self.full_dispatch_request() File "/usr/lib/python3.9/site-packages/flask/app.py", line 1815, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/lib/python3.9/site-packages/flask/app.py", line 1718, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/lib/python3.9/site-packages/flask/_compat.py", line 35, in reraise raise value File "/usr/lib/python3.9/site-packages/flask/app.py", line 1813, in full_dispatch_request rv = self.dispatch_request() File "/usr/lib/python3.9/site-packages/flask/app.py", line 1799, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/app/mailu/internal/views/postfix.py", line 12, in postfix_dane_map return flask.jsonify('dane-only') if utils.has_dane_record(domain_name) else flask.abort(404) File "/app/mailu/utils.py", line 61, in has_dane_record return app.config['DEFER_ON_TLS_ERROR'] NameError: name 'app' is not defined [2021-09-23 23:38:17,764] WARNING in utils: Unable to lookup the TLSA record for cerence-cloud.mail.protection.outlook.com. Is the DNSSEC zone okay on https://dnsviz.net/d/-cloud.mail.protection.outlook.com/dnssec/? [2021-09-23 23:38:17,765] ERROR in app: Exception on /internal/postfix/dane/-cloud.mail.protection.outlook.com [GET] Traceback (most recent call last): File "/app/mailu/utils.py", line 49, in has_dane_record result = resolver.query(f'_25._tcp.{domain}', dns.rdatatype.TLSA,dns.rdataclass.IN, lifetime=timeout) File "/usr/lib/python3.9/site-packages/dns/resolver.py", line 898, in query raise NoNameservers(request=request, errors=errors) dns.resolver.NoNameservers: All nameservers failed to answer the query _25._tcp.cloud.mail.protection.outlook.com. IN TLSA: Server 172.18.0.2 UDP port 53 answered SERVFAIL During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3.9/site-packages/flask/app.py", line 2292, in wsgi_app response = self.full_dispatch_request() File "/usr/lib/python3.9/site-packages/flask/app.py", line 1815, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/lib/python3.9/site-packages/flask/app.py", line 1718, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/lib/python3.9/site-packages/flask/_compat.py", line 35, in reraise raise value File "/usr/lib/python3.9/site-packages/flask/app.py", line 1813, in full_dispatch_request rv = self.dispatch_request() File "/usr/lib/python3.9/site-packages/flask/app.py", line 1799, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/app/mailu/internal/views/postfix.py", line 12, in postfix_dane_map return flask.jsonify('dane-only') if utils.has_dane_record(domain_name) else flask.abort(404) File "/app/mailu/utils.py", line 61, in has_dane_record return app.config['DEFER_ON_TLS_ERROR'] NameError: name 'app' is not defined FROM THE POSTFIX LOG (when we are doing a submit of a mail with the same client we have used since we started the development / use of the service) Sep 23 23:45:27 mail postfix/smtpd[2583]: connect from 10-196-225-85.secops-mail-service-mailu-front.secops-system.svc.cluster.local[10.196.225.85] Sep 23 23:45:27 mail postfix/smtpd[2583]: discarding EHLO keywords: PIPELINING Sep 23 23:45:27 mail postfix/smtpd[2583]: discarding EHLO keywords: PIPELINING Sep 23 23:45:28 mail postfix/smtpd[2583]: 516185A0C77: client=10-196-226-1.internal-istio-ingressgateway.istio-system.svc.cluster.local[10.196.226.1], sasl_method=XCLIENT, sasl_username=demoadm@mail. Sep 23 23:45:28 mail postfix/cleanup[2719]: 516185A0C77: replace: header Received: from localhost (10-196-226-1.internal-istio-ingressgateway.istio-system.svc.cluster.local [10.196.226.1])??by mail. (Postfix) with ESMTPA id 516185A0C77??for <lmc from 10-196-226-1.internal-istio-ingressgateway.istio-system.svc.cluster.local[10.196.226.1]; from=<demoadm@systems> to=<[email protected]> proto=ESMTP helo=<localhost>: Received: from authenticated-user (mail.[10.196.225.152])??by mail. (Postfix) with ESMTPA id 516185A0C77??for <[email protected]>; Thu, 23 Sep 2021 23:45:28 +0000 (UTC) Sep 23 23:45:28 mail postfix/cleanup[2719]: 516185A0C77: message-id=<> Sep 23 23:45:28 mail postfix/qmgr[377]: 516185A0C77: from=<[email protected]>, size=380, nrcpt=1 (queue active) Sep 23 23:45:28 mail postfix/smtpd[2583]: disconnect from 10-196-226-1.internal-istio-ingressgateway.istio-system.svc.cluster.local[10.196.226.1] ehlo=2 xclient=0/1 mail=1 rcpt=1 data=1 quit=1 commands=6/7 ERROR:root:Error when processing request Traceback (most recent call last): File "/usr/lib/python3.9/site-packages/podop/postfix.py", line 104, in process_request result = await table.get(key) File "/usr/lib/python3.9/site-packages/podop/table.py", line 35, in get raise Exception(request.status) Exception: 500 Sep 23 23:45:28 mail postfix/smtp[2720]: warning: socketmap:unix:/tmp/podop.socket:dane socketmap server temporary error: unknown error Sep 23 23:45:28 mail postfix/smtp[2720]: warning: socketmap:unix:/tmp/podop.socket:dane lookup error for "-cloud.mail.protection.outlook.com" Sep 23 23:45:28 mail postfix/smtp[2720]: warning: smtp_tls_policy_maps, next-hop destination "-cloud.mail.protection.outlook.com": policy table lookup error Sep 23 23:45:28 mail postfix/smtp[2720]: warning: TLS policy lookup for -cloud.mail.protection.outlook.com/-cloud.mail.protection.outlook.com: client TLS configuration problem Sep 23 23:45:28 mail postfix/smtp[2720]: warning: TLS policy lookup for -cloud.mail.protection.outlook.com/-cloud.mail.protection.outlook.com: client TLS configuration problem Sep 23 23:45:28 mail postfix/smtp[2720]: 516185A0C77: to=<[email protected]>, relay=none, delay=0.8, delays=0.36/0.1/0.34/0, dsn=4.7.5, status=deferred (client TLS configuration problem) Mail Rejected/Failed to Send to Relay HOST - DANE exceptions in ADMIN, Similar in POSTFIX Thank you for opening an issue with Mailu. Please understand that issues are meant for bugs and enhancement-requests. For **user-support questions**, reach out to us on [matrix](https://matrix.to/#/#mailu:tedomum.net). To be able to help you best, we need some more information. ## Before you open your issue - [ X] Check if no issue or pull-request for this already exists. - [ ] Check [documentation](https://mailu.io/master/) and [FAQ](https://mailu.io/master/faq.html). (Tip, use the search function on the documentation page) - [ ] You understand `Mailu` is made by volunteers in their **free time** โ€” be conscise, civil and accept that delays can occur. - [ ] The title of the issue should be short and simple. It should contain specific terms related to the actual issue. Be specific while writing the title. ## Environment & Versions ### Environment - [ ] docker-compose - [ X] kubernetes - [ ] docker swarm ### Versions To find your version, get the image name of a mailu container and read the version from the tag (example for version 1.7). ``` $> docker ps -a | grep mailu 140b09d4b09c mailu/roundcube:1.7 "docker-php-entrypoiโ€ฆ" 2 weeks ago Up 2 days (healthy) 80/tcp $> grep MAILU_VERSION docker-compose.yml mailu.env ``` LATEST VERSION (from helm chart) ## Description Further explain the bug in a few words. It should be clear what the unexpected behaviour is. Share it in an easy-to-understand language. We are sending mail to mailu, this was working with our configuration for about 1 year so far, during a recent K8s upgrade and following, we see that pod were redployed and now we see the errors in the logs when we are doing the same STARTTLS submit to the mail server that we have been doing prior ## Replication Steps No idea, update the mailu to the latest release and that is what we saw ## Expected behaviour the mail to work ## Logs Here is the log from the ADMIN component, you can see its throwing an exception, we did the dig and nsloookup on the pod and there is no issues resoving the host, we did NETCAT and can connect from the ADMIN pod and the POSTFIX PODS and can do submit over netcat (command line ELHO/HELO, etc) ADMIN LOG During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3.9/site-packages/flask/app.py", line 2292, in wsgi_app response = self.full_dispatch_request() File "/usr/lib/python3.9/site-packages/flask/app.py", line 1815, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/lib/python3.9/site-packages/flask/app.py", line 1718, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/lib/python3.9/site-packages/flask/_compat.py", line 35, in reraise raise value File "/usr/lib/python3.9/site-packages/flask/app.py", line 1813, in full_dispatch_request rv = self.dispatch_request() File "/usr/lib/python3.9/site-packages/flask/app.py", line 1799, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/app/mailu/internal/views/postfix.py", line 12, in postfix_dane_map return flask.jsonify('dane-only') if utils.has_dane_record(domain_name) else flask.abort(404) File "/app/mailu/utils.py", line 61, in has_dane_record return app.config['DEFER_ON_TLS_ERROR'] NameError: name 'app' is not defined [2021-09-23 23:38:17,764] WARNING in utils: Unable to lookup the TLSA record for cerence-cloud.mail.protection.outlook.com. Is the DNSSEC zone okay on https://dnsviz.net/d/-cloud.mail.protection.outlook.com/dnssec/? [2021-09-23 23:38:17,765] ERROR in app: Exception on /internal/postfix/dane/-cloud.mail.protection.outlook.com [GET] Traceback (most recent call last): File "/app/mailu/utils.py", line 49, in has_dane_record result = resolver.query(f'_25._tcp.{domain}', dns.rdatatype.TLSA,dns.rdataclass.IN, lifetime=timeout) File "/usr/lib/python3.9/site-packages/dns/resolver.py", line 898, in query raise NoNameservers(request=request, errors=errors) dns.resolver.NoNameservers: All nameservers failed to answer the query _25._tcp.cloud.mail.protection.outlook.com. IN TLSA: Server 172.18.0.2 UDP port 53 answered SERVFAIL During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3.9/site-packages/flask/app.py", line 2292, in wsgi_app response = self.full_dispatch_request() File "/usr/lib/python3.9/site-packages/flask/app.py", line 1815, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/lib/python3.9/site-packages/flask/app.py", line 1718, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/lib/python3.9/site-packages/flask/_compat.py", line 35, in reraise raise value File "/usr/lib/python3.9/site-packages/flask/app.py", line 1813, in full_dispatch_request rv = self.dispatch_request() File "/usr/lib/python3.9/site-packages/flask/app.py", line 1799, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/app/mailu/internal/views/postfix.py", line 12, in postfix_dane_map return flask.jsonify('dane-only') if utils.has_dane_record(domain_name) else flask.abort(404) File "/app/mailu/utils.py", line 61, in has_dane_record return app.config['DEFER_ON_TLS_ERROR'] NameError: name 'app' is not defined FROM THE POSTFIX LOG (when we are doing a submit of a mail with the same client we have used since we started the development / use of the service) Sep 23 23:45:27 mail postfix/smtpd[2583]: connect from 10-196-225-85.secops-mail-service-mailu-front.secops-system.svc.cluster.local[10.196.225.85] Sep 23 23:45:27 mail postfix/smtpd[2583]: discarding EHLO keywords: PIPELINING Sep 23 23:45:27 mail postfix/smtpd[2583]: discarding EHLO keywords: PIPELINING Sep 23 23:45:28 mail postfix/smtpd[2583]: 516185A0C77: client=10-196-226-1.internal-istio-ingressgateway.istio-system.svc.cluster.local[10.196.226.1], sasl_method=XCLIENT, sasl_username=demoadm@mail. Sep 23 23:45:28 mail postfix/cleanup[2719]: 516185A0C77: replace: header Received: from localhost (10-196-226-1.internal-istio-ingressgateway.istio-system.svc.cluster.local [10.196.226.1])??by mail. (Postfix) with ESMTPA id 516185A0C77??for <lmc from 10-196-226-1.internal-istio-ingressgateway.istio-system.svc.cluster.local[10.196.226.1]; from=<demoadm@systems> to=<[email protected]> proto=ESMTP helo=<localhost>: Received: from authenticated-user (mail.[10.196.225.152])??by mail. (Postfix) with ESMTPA id 516185A0C77??for <[email protected]>; Thu, 23 Sep 2021 23:45:28 +0000 (UTC) Sep 23 23:45:28 mail postfix/cleanup[2719]: 516185A0C77: message-id=<> Sep 23 23:45:28 mail postfix/qmgr[377]: 516185A0C77: from=<[email protected]>, size=380, nrcpt=1 (queue active) Sep 23 23:45:28 mail postfix/smtpd[2583]: disconnect from 10-196-226-1.internal-istio-ingressgateway.istio-system.svc.cluster.local[10.196.226.1] ehlo=2 xclient=0/1 mail=1 rcpt=1 data=1 quit=1 commands=6/7 ERROR:root:Error when processing request Traceback (most recent call last): File "/usr/lib/python3.9/site-packages/podop/postfix.py", line 104, in process_request result = await table.get(key) File "/usr/lib/python3.9/site-packages/podop/table.py", line 35, in get raise Exception(request.status) Exception: 500 Sep 23 23:45:28 mail postfix/smtp[2720]: warning: socketmap:unix:/tmp/podop.socket:dane socketmap server temporary error: unknown error Sep 23 23:45:28 mail postfix/smtp[2720]: warning: socketmap:unix:/tmp/podop.socket:dane lookup error for "-cloud.mail.protection.outlook.com" Sep 23 23:45:28 mail postfix/smtp[2720]: warning: smtp_tls_policy_maps, next-hop destination "-cloud.mail.protection.outlook.com": policy table lookup error Sep 23 23:45:28 mail postfix/smtp[2720]: warning: TLS policy lookup for -cloud.mail.protection.outlook.com/-cloud.mail.protection.outlook.com: client TLS configuration problem Sep 23 23:45:28 mail postfix/smtp[2720]: warning: TLS policy lookup for -cloud.mail.protection.outlook.com/-cloud.mail.protection.outlook.com: client TLS configuration problem Sep 23 23:45:28 mail postfix/smtp[2720]: 516185A0C77: to=<[email protected]>, relay=none, delay=0.8, delays=0.36/0.1/0.34/0, dsn=4.7.5, status=deferred (client TLS configuration problem)
2021-09-24T08:21:52
Mailu/Mailu
2,007
Mailu__Mailu-2007
[ "1948" ]
c22d853c1a39b670837a547b4d78d53b2d04931e
diff --git a/core/admin/mailu/configuration.py b/core/admin/mailu/configuration.py --- a/core/admin/mailu/configuration.py +++ b/core/admin/mailu/configuration.py @@ -49,6 +49,7 @@ 'DKIM_PATH': '/dkim/{domain}.{selector}.key', 'DEFAULT_QUOTA': 1000000000, 'MESSAGE_RATELIMIT': '200/day', + 'RECIPIENT_DELIMITER': '', # Web settings 'SITENAME': 'Mailu', 'WEBSITE': 'https://mailu.io', diff --git a/core/admin/mailu/internal/views/postfix.py b/core/admin/mailu/internal/views/postfix.py --- a/core/admin/mailu/internal/views/postfix.py +++ b/core/admin/mailu/internal/views/postfix.py @@ -140,6 +140,7 @@ def postfix_sender_login(sender): localpart, domain_name = models.Email.resolve_domain(sender) if localpart is None: return flask.jsonify(",".join(wildcard_senders)) if wildcard_senders else flask.abort(404) + localpart = localpart[:next((i for i, ch in enumerate(localpart) if ch in flask.current_app.config.get('RECIPIENT_DELIMITER')), None)] destination = models.Email.resolve_destination(localpart, domain_name, True) destination = [*destination, *wildcard_senders] if destination else [*wildcard_senders] return flask.jsonify(",".join(destination)) if destination else flask.abort(404)
Reply to a letter from a subaddress Now, if an email has been sent to a subaddress, for example, ```[email protected]``` and when you try to answer it, the address of the poisoner will be indicated ```[email protected]``` not ```[email protected]```. Is it possible to reply from the same address to which the letter was sent?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Hi. It is up to the user agent how to handle the subaddress part. You should be able to configure multiple identities when using the optional webmail component of mailu. Alex This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. > Hi. It is up to the user agent how to handle the subaddress part. You should be able to configure multiple identities when using the optional webmail component of mailu. Alex Can I please have a more detailed answer? If something is required of me, I can also explain in more detail. Sorry, English is not my native language. > Can I please have a more detailed answer? > If something is required of me, I can also explain in more detail. Sorry, English is not my native language. You just need to set "[email protected]" as your sender address in your email-client. But I've found a bug preventing you from sending emails this way. I'll fix it.
2021-10-09T15:17:50
Mailu/Mailu
2,017
Mailu__Mailu-2017
[ "1179" ]
a9ec601e3e9cf7d935cae6bb49e156c057879546
diff --git a/core/admin/mailu/internal/views/__init__.py b/core/admin/mailu/internal/views/__init__.py --- a/core/admin/mailu/internal/views/__init__.py +++ b/core/admin/mailu/internal/views/__init__.py @@ -1,3 +1,3 @@ __all__ = [ - 'auth', 'postfix', 'dovecot', 'fetch' + 'auth', 'postfix', 'dovecot', 'fetch', 'rspamd' ] diff --git a/core/admin/mailu/internal/views/rspamd.py b/core/admin/mailu/internal/views/rspamd.py new file mode 100644 --- /dev/null +++ b/core/admin/mailu/internal/views/rspamd.py @@ -0,0 +1,30 @@ +from mailu import models +from mailu.internal import internal + +import flask + +def vault_error(*messages, status=404): + return flask.make_response(flask.jsonify({'errors':messages}), status) + +# rspamd key format: +# {"selectors":[{"pubkey":"...","domain":"...","valid_start":TS,"valid_end":TS,"key":"...","selector":"...","bits":...,"alg":"..."}]} + +# hashicorp vault answer format: +# {"request_id":"...","lease_id":"","renewable":false,"lease_duration":2764800,"data":{...see above...},"wrap_info":null,"warnings":null,"auth":null} + [email protected]("/rspamd/vault/v1/dkim/<domain_name>", methods=['GET']) +def rspamd_dkim_key(domain_name): + domain = models.Domain.query.get(domain_name) or flask.abort(vault_error('unknown domain')) + key = domain.dkim_key or flask.abort(vault_error('no dkim key', status=400)) + return flask.jsonify({ + 'data': { + 'selectors': [ + { + 'domain' : domain.name, + 'key' : key.decode('utf8'), + 'selector': flask.current_app.config.get('DKIM_SELECTOR', 'dkim'), + } + ] + } + }) + diff --git a/core/rspamd/start.py b/core/rspamd/start.py --- a/core/rspamd/start.py +++ b/core/rspamd/start.py @@ -11,6 +11,7 @@ # Actual startup script os.environ["REDIS_ADDRESS"] = system.get_host_address_from_environment("REDIS", "redis") +os.environ["ADMIN_ADDRESS"] = system.get_host_address_from_environment("ADMIN", "admin") if os.environ.get("ANTIVIRUS") == 'clamav': os.environ["ANTIVIRUS_ADDRESS"] = system.get_host_address_from_environment("ANTIVIRUS", "antivirus:3310")
DNS and Dkim Problem In the anti-spam logs, I get these messages ` 24.09.2019, 11:18:00 | rspamd_proxy | 6 | proxy | ea17f2 | cannot load dkim key /dkim/gmail.com.dkim.key: cannot stat key file: '/dkim/gmail.com.dkim.key' No such file or directory -- | -- | -- | -- | -- | -- 24.09.2019, 11:13:36 | controller | 8 | map | fdp86m | cannot resolve maps.rspamd.com: query timed out 24.09.2019, 11:07:43 | controller | 8 | map | f61zu5 | cannot resolve maps.rspamd.com: query timed out 24.09.2019, 10:43:39 | rspamd_proxy | 6 | proxy | 6a4515 | cannot load dkim key /dkim/yandex.ru.dkim.key: cannot stat key file: '/dkim/yandex.ru.dkim.key' No such file or directory 24.09.2019, 10:43:01 | rspamd_proxy | 6 | proxy | a2ab83 | cannot load dkim key /dkim/gmail.com.dkim.key: cannot stat key file: '/dkim/gmail.com.dkim.key' No such file or directory 24.09.2019, 10:25:29 | rspamd_proxy | 6 | lua | bd13df | Error querying DNS(79b02fcb6777cde57178ac941273706740344a80.ebl.msbl.org): query timed out 24.09.2019, 10:25:29 | rspamd_proxy | 6 | lua | bd13df | Error querying DNS(fo1wk7518dya4hdfz8g3g7zdfb1c35yw.email.rspamd.com): query timed out 24.09.2019, 10:25:29 | rspamd_proxy | 6 | lua | bd13df | Error querying DNS(qu96fwbu1qxunkig79rpxczqoj7be4ru.email.rspamd.com): query timed out 24.09.2019, 10:25:29 | rspamd_proxy | 6 | lua | bd13df | Error querying DNS(a5f235fe09bd538afb3515a78f2462e510d415af.ebl.msbl.org): query timed out 24.09.2019, 10:16:21 | rspamd_proxy | 6 | lua | aa1a3a | Error querying DNS(fo1wk7518dya4hdfz8g3g7zdfb1c35yw.email.rspamd.com): query timed out ` What could be the problem?
I have similar problem: `antispam_1 | 2019-10-27 14:39:37 #10(controller) <zcfokz>; map; rspamd_kv_list_fin: read hash of 1531 elements antispam_1 | 2019-10-27 14:39:42 #10(controller) <fdp86m>; map; rspamd_map_dns_callback: cannot resolve maps.rspamd.com antispam_1 | 2019-10-27 14:39:42 #10(controller) <k8f914>; map; rspamd_map_dns_callback: cannot resolve maps.rspamd.com antispam_1 | 2019-10-27 14:39:42 #10(controller) <k8f914>; map; rspamd_map_dns_callback: cannot resolve maps.rspamd.com antispam_1 | 2019-10-27 14:39:42 #10(controller) <fdp86m>; map; rspamd_map_dns_callback: cannot resolve maps.rspamd.com antispam_1 | 2019-10-27 14:39:42 #10(controller) <xa6qqy>; map; rspamd_map_dns_callback: cannot resolve rspamd.com antispam_1 | 2019-10-27 14:39:42 #10(controller) <pr5857>; map; rspamd_map_dns_callback: cannot resolve updates.rspamd.com antispam_1 | 2019-10-27 14:39:42 #10(controller) <fdp86m>; map; rspamd_map_dns_callback: cannot resolve maps.rspamd.com` I run iptables -t nat -A POSTROUTING ! -o docker0 -s 192.168.203.0/24 -j MASQUERADE and now it is working. Many of these problems are indeed related to people having way too general outbound masquerading rules. You should never masquerade internal traffic to your Docker. Please use specific masquerading rules. Also, blogwebpl's suggestion will not hold since compose projects will have their own host interface instead of docker0. Hi! I think you answered to the DNS errors problem, but there is still the issue with the dkim keys which cannot be loaded. I have the exact same issue: cannot load dkim key /dkim/gmail.com.dkim.key: cannot stat key file: '/dkim/gmail.com.dkim.key' No such file or directory It seems pretty normal for rspamd to not be able to find these keys since there are for external domains. It looks identical to [this issue](https://github.com/rspamd/rspamd/issues/2832), so I bet for a configuration issue ([here?](https://github.com/Mailu/Mailu/blob/master/core/rspamd/conf/dkim_signing.conf#L1)). I'm not sure about the reason to use fallback, and even less about the implication of keeping it as it is or not, so I'll let you answer that :wink: Thanks for insisting on the issue about falling back. This might be an easy fix indeed. Hi There, The `Mailu`-Project is currently in a bit of a bind! We are short on man-power, and we need to judge if it is possible for us to put in some work on this issue. To help with that, we are currently trying to find out which issues are actively keeping users from using `Mailu`, which issues have someone who want to work on them โ€” and which issues may be less important. These a less important ones could be discarded for the time being, until the project is in a more stable and regular state once again. In order for us to better assess this, it would be helpful if you could put a **reaction on this post** (use the :smiley: icon to the top-right). - ๐Ÿ‘๏ธ if you **need this** to be able to use Mailu. Ideally, youโ€™d also be able to test this on your installation, and provide feedback โ€ฆ - ๐ŸŽ‰ if you find it a **nice bonus**, but no deal-breaker - ๐Ÿš€ if you want to **work on it yourself**! We want to keep this **voting open for 2 weeks** from now, so please help out! This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Ran into this issue, my fix for the DKIM problem was to generate the Rspamd dkim key file. `docker exec -it mailu_antispam_1 /bin/bash rspamadm dkim_keygen -s 'dkim' -d example.com -k /dkim/example.com.dkim.key` This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
2021-10-15T11:37:52
Mailu/Mailu
2,018
Mailu__Mailu-2018
[ "1382" ]
a9ec601e3e9cf7d935cae6bb49e156c057879546
diff --git a/core/admin/mailu/models.py b/core/admin/mailu/models.py --- a/core/admin/mailu/models.py +++ b/core/admin/mailu/models.py @@ -243,6 +243,13 @@ def dns_dmarc(self): ruf = f' ruf=mailto:{ruf}@{domain};' if ruf else '' return f'_dmarc.{self.name}. 600 IN TXT "v=DMARC1; p=reject;{rua}{ruf} adkim=s; aspf=s"' + @cached_property + def dns_dmarc_report(self): + """ return DMARC report record for mailu server """ + if self.dkim_key: + domain = app.config['DOMAIN'] + return f'{self.name}._report._dmarc.{domain}. 600 IN TXT "v=DMARC1"' + @cached_property def dns_autoconfig(self): """ return list of auto configuration records (RFC6186) """
DKIM with multiple mail domains I have a few small mail domains in mailu and I have setup DMARC records with rua and ruf mail addresses. The DMARC record vor domainA reads: _dmarc.domainA.ch. 600 IN TXT "v=DMARC1; p=reject; rua=mailto:[email protected]; ruf=mailto:[email protected]; adkim=s; aspf=s" However, this does not work unless there exists another DNS entry in the smtp.masterdomain.ch zone: domainA.ch._report._dmarc.smtp.masterdomain.ch. TXT "v=DMARC1" or *._report._dmarc.smtp.masterdomain.ch. TXT "v=DMARC1" When this entry is missing, some emails get rejected (sometimes), and flagged as 'dkim=fail'. I believe this is why I sometimes get mails rejected by hotmail.com. Would it be possible to add these required DNS records to the Domain Details page /admin/ui/domain/details/domainA.ch ? See also: https://forum.directadmin.com/threads/how-to-setup-a-dns-record-to-recevie-report-for-dmarc-report-from-other-domains.56175/post-292355 Thanks, Peter
Hi There, The `Mailu`-Project is currently in a bit of a bind! We are short on man-power, and we need to judge if it is possible for us to put in some work on this issue. To help with that, we are currently trying to find out which issues are actively keeping users from using `Mailu`, which issues have someone who want to work on them โ€” and which issues may be less important. These a less important ones could be discarded for the time being, until the project is in a more stable and regular state once again. In order for us to better assess this, it would be helpful if you could put a **reaction on this post** (use the :smiley: icon to the top-right). - ๐Ÿ‘๏ธ if you **need this** to be able to use Mailu. Ideally, youโ€™d also be able to test this on your installation, and provide feedback โ€ฆ - ๐ŸŽ‰ if you find it a **nice bonus**, but no deal-breaker - ๐Ÿš€ if you want to **work on it yourself**! We want to keep this **voting open for 2 weeks** from now, so please help out! This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. This should at least be added to the documentation. It would indeed be nice if this is displayed in the domain details page.
2021-10-15T12:24:55
Mailu/Mailu
2,034
Mailu__Mailu-2034
[ "1154" ]
11bbceb9cc4527516f66c80c56c96f0a9e394534
diff --git a/core/admin/mailu/configuration.py b/core/admin/mailu/configuration.py --- a/core/admin/mailu/configuration.py +++ b/core/admin/mailu/configuration.py @@ -72,6 +72,7 @@ 'SESSION_LIFETIME': 24, 'SESSION_COOKIE_SECURE': True, 'CREDENTIAL_ROUNDS': 12, + 'TZ': 'Etc/UTC', # Host settings 'HOST_IMAP': 'imap', 'HOST_LMTP': 'imap:2525',
Timezone in containers Hello, I have seen that timezones are not set for containers. This causes logs to have wrong timestamps and email "received" headers have wrong timezones. It should be possible to set the timezone for all containers. The setting should be exposed and described in the .env file.
On my own server I passthrough the timezone to every container via volume: ``` volumes: - "/etc/localtime:/etc/localtime:ro" ``` So I only have to take care of the timezone for host system. Hi There, The `Mailu`-Project is currently in a bit of a bind! We are short on man-power, and we need to judge if it is possible for us to put in some work on this issue. To help with that, we are currently trying to find out which issues are actively keeping users from using `Mailu`, which issues have someone who want to work on them โ€” and which issues may be less important. These a less important ones could be discarded for the time being, until the project is in a more stable and regular state once again. In order for us to better assess this, it would be helpful if you could put a **reaction on this post** (use the :smiley: icon to the top-right). - ๐Ÿ‘๏ธ if you **need this** to be able to use Mailu. Ideally, youโ€™d also be able to test this on your installation, and provide feedback โ€ฆ - ๐ŸŽ‰ if you find it a **nice bonus**, but no deal-breaker - ๐Ÿš€ if you want to **work on it yourself**! We want to keep this **voting open for 2 weeks** from now, so please help out! This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Thank you for your offer, @atl285 ! It looks like just mounting /etc/localtime does not do the job on recent alpine images. I also need to mount /usr/share/zoneinfo or alternatively install the tzdata package to make it work. Since that requires special knowledge, it's probably better to handle it within the images. It is possible to install the tzdata package and provide the timezone in the .env file. I could make a PR for this if wanted.
2021-11-02T10:29:50
Mailu/Mailu
2,035
Mailu__Mailu-2035
[ "2031" ]
7c03878347455195183626b2ddfa74624c4b2900
diff --git a/webmails/roundcube/start.py b/webmails/roundcube/start.py --- a/webmails/roundcube/start.py +++ b/webmails/roundcube/start.py @@ -1,61 +1,105 @@ #!/usr/bin/python3 import os -import logging as log +import logging import sys from socrate import conf import subprocess +import hmac -log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", "WARNING")) +env = os.environ -os.environ["MAX_FILESIZE"] = str(int(int(os.environ.get("MESSAGE_SIZE_LIMIT")) * 0.66 / 1048576)) +logging.basicConfig(stream=sys.stderr, level=env.get("LOG_LEVEL", "WARNING")) -db_flavor = os.environ.get("ROUNDCUBE_DB_FLAVOR", "sqlite") +# jinja context +context = {} +context.update(env) + +context["MAX_FILESIZE"] = str(int(int(env.get("MESSAGE_SIZE_LIMIT", "50000000")) * 0.66 / 1048576)) + +db_flavor = env.get("ROUNDCUBE_DB_FLAVOR", "sqlite") if db_flavor == "sqlite": - os.environ["DB_DSNW"] = "sqlite:////data/roundcube.db" + context["DB_DSNW"] = "sqlite:////data/roundcube.db" elif db_flavor == "mysql": - os.environ["DB_DSNW"] = "mysql://%s:%s@%s/%s" % ( - os.environ.get("ROUNDCUBE_DB_USER", "roundcube"), - os.environ.get("ROUNDCUBE_DB_PW"), - os.environ.get("ROUNDCUBE_DB_HOST", "database"), - os.environ.get("ROUNDCUBE_DB_NAME", "roundcube") + context["DB_DSNW"] = "mysql://%s:%s@%s/%s" % ( + env.get("ROUNDCUBE_DB_USER", "roundcube"), + env.get("ROUNDCUBE_DB_PW"), + env.get("ROUNDCUBE_DB_HOST", "database"), + env.get("ROUNDCUBE_DB_NAME", "roundcube") ) elif db_flavor == "postgresql": - os.environ["DB_DSNW"] = "pgsql://%s:%s@%s/%s" % ( - os.environ.get("ROUNDCUBE_DB_USER", "roundcube"), - os.environ.get("ROUNDCUBE_DB_PW"), - os.environ.get("ROUNDCUBE_DB_HOST", "database"), - os.environ.get("ROUNDCUBE_DB_NAME", "roundcube") + context["DB_DSNW"] = "pgsql://%s:%s@%s/%s" % ( + env.get("ROUNDCUBE_DB_USER", "roundcube"), + env.get("ROUNDCUBE_DB_PW"), + env.get("ROUNDCUBE_DB_HOST", "database"), + env.get("ROUNDCUBE_DB_NAME", "roundcube") ) else: - print("Unknown ROUNDCUBE_DB_FLAVOR: %s", db_flavor) + print(f"Unknown ROUNDCUBE_DB_FLAVOR: {db_flavor}", file=sys.stderr) exit(1) -conf.jinja("/php.ini", os.environ, "/usr/local/etc/php/conf.d/roundcube.ini") +# derive roundcube secret key +secret_key = env.get("SECRET_KEY") +if not secret_key: + try: + secret_key = open(env.get("SECRET_KEY_FILE"), "r").read().strip() + except Exception as exc: + print(f"Can't read SECRET_KEY from file: {exc}", file=sys.stderr) + exit(2) + +context['SECRET_KEY'] = hmac.new(bytearray(secret_key, 'utf-8'), bytearray('ROUNDCUBE_KEY', 'utf-8'), 'sha256').hexdigest() + +# roundcube plugins +# (using "dict" because it is ordered and "set" is not) +plugins = dict((p, None) for p in env.get("ROUNDCUBE_PLUGINS", "").replace(" ", "").split(",") if p and os.path.isdir(os.path.join("/var/www/plugins", p))) +if plugins: + plugins["mailu"] = None +else: + plugins = dict((k, None) for k in ["archive", "zipdownload", "markasjunk", "managesieve", "enigma", "carddav", "mailu"]) + +context["PLUGINS"] = ",".join(f"'{p}'" for p in plugins) -# Create dirs, setup permissions +# add overrides +context["INCLUDES"] = sorted(inc for inc in os.listdir("/overrides") if inc.endswith(".inc")) if os.path.isdir("/overrides") else [] + +# create config files +conf.jinja("/php.ini", context, "/usr/local/etc/php/conf.d/roundcube.ini") +conf.jinja("/config.inc.php", context, "/var/www/html/config/config.inc.php") + +# create dirs os.system("mkdir -p /data/gpg") +print("Initializing database") try: - print("Initializing database") result = subprocess.check_output(["/var/www/html/bin/initdb.sh", "--dir", "/var/www/html/SQL"], stderr=subprocess.STDOUT) print(result.decode()) -except subprocess.CalledProcessError as e: - if "already exists" in e.stdout.decode(): +except subprocess.CalledProcessError as exc: + err = exc.stdout.decode() + if "already exists" in err: print("Already initialzed") else: - print(e.stdout.decode()) - quit(1) + print(err) + exit(3) +print("Upgrading database") try: - print("Upgrading database") subprocess.check_call(["/var/www/html/bin/update.sh", "--version=?", "-y"], stderr=subprocess.STDOUT) -except subprocess.CalledProcessError as e: - quit(1) +except subprocess.CalledProcessError as exc: + exit(4) +else: + print("Cleaning database") + try: + subprocess.check_call(["/var/www/html/bin/cleandb.sh"], stderr=subprocess.STDOUT) + except subprocess.CalledProcessError as exc: + exit(5) -# Setup database permissions +# setup permissions os.system("chown -R www-data:www-data /data") -# Run apache -os.execv("/usr/local/bin/apache2-foreground", ["apache2-foreground"]) +# clean env +[env.pop(key, None) for key in env.keys() if key == "SECRET_KEY" or key.startswith("ROUNDCUBE_")] + +# run apache +os.execve("/usr/local/bin/apache2-foreground", ["apache2-foreground"], env) +
Upgrade Roundcube to 1.5 ## Before you open your issue - [x] Check if no issue or pull-request for this already exists. - [x] Check [documentation](https://mailu.io/master/) and [FAQ](https://mailu.io/master/faq.html). (Tip, use the search function on the documentation page) - [x] You understand `Mailu` is made by volunteers in their **free time** โ€” be conscise, civil and accept that delays can occur. - [x] The title of the issue should be short and simple. It should contain specific terms related to the actual issue. Be specific while writing the title. ## Environment & Versions ### Environment - [x] docker-compose - [x] kubernetes - [x] docker swarm ### Versions Since this is not a bug report, Iโ€™m not sure if you need my current version. ## Description Currently, Mailu still uses version 1.4 of the Roundcube webmail client, which has recently received an update. Highlights of the 1.5 release are summarized in this [blogpost from roundcube.net](https://roundcube.net/news/2021/10/18/roundcube-1.5.0-released), though (for me) the most interesting are: - OAuth2 support - Elastic now comes with a dark mode From a quick glance at the Dockerfile, it didnโ€™t seem like there are any huge requirements, but Iโ€™ll give it a try later and see what happens. Iโ€™d be happy to contribute this change if it works, but I donโ€™t have a full picture of the behind the scenes of the mailu stack yet, so I may need help if I walk into any traps. Thank you all for your work with mailu! Itโ€™s an awesome project and really makes hosting a mailserver extremly easy, at least on a small scale. #### Changlog [2021-11-01 08:41 +00]: add thank you note
I did not know roundcube 1.5 was released. I see it was released only 2 weeks ago. We could have a look at including this with the next Mailu release. It should be a matter of updating the release tar.g.z url in the Dockerfile. At the same time the carddav plugin should also be updated to the newest version: https://github.com/mstilkerich/rcmcarddav/releases/download/v4.2.2/carddav-v4.2.2.tar.gz
2021-11-02T11:26:03
Mailu/Mailu
2,049
Mailu__Mailu-2049
[ "1223" ]
d8c6a2d15edce892c92363d45f8127cdd89ec8a4
diff --git a/optional/fetchmail/fetchmail.py b/optional/fetchmail/fetchmail.py --- a/optional/fetchmail/fetchmail.py +++ b/optional/fetchmail/fetchmail.py @@ -13,6 +13,7 @@ FETCHMAIL = """ fetchmail -N \ + --idfile /data/fetchids --uidl \ --sslcertck --sslcertpath /etc/ssl/certs \ -f {} """
Fetchmail: /var/lib/fetchmail needs persistence According [fetchmail documentation](https://www.fetchmail.info/fetchmail-man.html#12), an `.idfile` is used to keep track of previously downloaded messages. Shouldn't that file persistent over container restarts? I'm not a Fetchmail user, perhaps somebody can shine a light on how this currently works? cc: @Nebukadneza, @hoellen, @kaiyou
Yes, same here. I just updated mailu using docker-compose pull && docker-compose up -d --build and now I received hundreds of duplicate mails. image is: mailu/fetchmail:1.6 Which file we need is clear: ``` # docker container diff mailu_fetchmail_1 C /var C /var/lib C /var/lib/fetchmail A /var/lib/fetchmail/.ash_history A /var/lib/fetchmail/.fetchids ``` so I modified my docker-compose.yml like this: ``` fetchmail: volumes: - "/mnt/data-containerdata/mailu/fetchmail:/var/lib/fetchmail" ``` and pre-filled it using: ``` # docker cp mailu_fetchmail_1:/var/lib/fetchmail . # docker exec -ti mailu_fetchmail_1 ls -lan /var/lib/fetchmail total 20 drwxr-xr-x 1 100 101 4096 Oct 23 20:12 . drwxr-xr-x 1 0 0 4096 Oct 20 21:15 .. -rw------- 1 100 101 0 Oct 23 20:12 .ash_history -rw------- 1 100 101 4930 Oct 23 19:54 .fetchids # rm fetchmail/.ash_history # chown -R 100.101 fetchmail/ # ls -lan fetchmail/ total 16 drwxr-xr-x 2 100 101 4096 Oct 23 22:21 . drwxr-xr-x 13 0 0 4096 Oct 23 22:20 .. -rw------- 1 100 101 4930 Oct 23 21:54 .fetchids # docker-compose up -d fetchmail Recreating mailu_fetchmail_1 ... done ``` Is this a new requirement? I remember using fetchmail intensively at first and not bumping into this. it only happens if the "Keep emails" option is set in "Fetched accounts". It's about the file which keeps track which mails were already downloaded. Without this file, all mails on the server are considered "new" @kaiyou @hoellen @muhlemmer , I see that flavors/stack/docker-compose.yml already proposes a volume : - "{{ root }}/data:/data" I propose it should rather be - "{{ root }}/fetchmail:/var/lib/fetchmail" and that we push the same change on setup/flavors/compose/docker-compose.yml and docs/compose/docker-compose.yml ? I can push a PR for this if needed With version 1.7, the file is now in /home/fetchmail/, see ``` # docker diff mailu_fetchmail_1 C /home C /home/fetchmail A /home/fetchmail/.fetchids ``` This led again to a lot of duplicates in my mailbox. @ofthesun9: I also vote for a path like fetchmail on host side. but it must also match with the container inside Hi There, The `Mailu`-Project is currently in a bit of a bind! We are short on man-power, and we need to judge if it is possible for us to put in some work on this issue. To help with that, we are currently trying to find out which issues are actively keeping users from using `Mailu`, which issues have someone who want to work on them โ€” and which issues may be less important. These a less important ones could be discarded for the time being, until the project is in a more stable and regular state once again. In order for us to better assess this, it would be helpful if you could put a **reaction on this post** (use the :smiley: icon to the top-right). - ๐Ÿ‘๏ธ if you **need this** to be able to use Mailu. Ideally, youโ€™d also be able to test this on your installation, and provide feedback โ€ฆ - ๐ŸŽ‰ if you find it a **nice bonus**, but no deal-breaker - ๐Ÿš€ if you want to **work on it yourself**! We want to keep this **voting open for 2 weeks** from now, so please help out! This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
2021-11-10T09:15:29
Mailu/Mailu
2,069
Mailu__Mailu-2069
[ "1838", "1838" ]
08be23360756f1fa4dc2841d04b0dbe7cff68cf9
diff --git a/optional/postgresql/start.py b/optional/postgresql/start.py deleted file mode 100755 --- a/optional/postgresql/start.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/python3 - -import anosql -import psycopg2 -import glob -import os -import subprocess -from socrate import conf - -def setup(): - conn = psycopg2.connect(user='postgres') - queries = anosql.load_queries('postgres', '/conf/queries.sql') - # Mailu user - queries.create_mailu_user(conn) - queries.update_pw(conn, pw=os.environ.get("DB_PW")) - # Healthcheck user - queries.create_health_user(conn) - queries.grant_health(conn) - conn.commit() - # create db cannot be atomic. But this script is the only active connection, this is kinda safe. - if not queries.check_db(conn): - conn.set_isolation_level(0) - queries.create_db(conn) - conn.set_isolation_level(1) - conn.close() - -# Check if /data is empty -if not os.listdir("/data"): - os.system("chown -R postgres:postgres /data") - os.system("chmod 0700 /data") - base_backups=sorted(glob.glob("/backup/base-*")) - if base_backups: - # Restore the latest backup - subprocess.call(["tar", "--same-owner", "-zpxf", base_backups[-1] + "/base.tar.gz" , "-C", "/data"]) - if os.listdir("/backup/wal_archive"): - with open("/data/recovery.conf", "w") as rec: - rec.write("restore_command = 'gunzip < /backup/wal_archive/%f > %p'\n") - rec.write("standby_mode = off\n") - os.system("chown postgres:postgres /data/recovery.conf") - else: - # Bootstrap the database - os.system("sudo -u postgres initdb -D /data") - -# Create backup directory structure, if it does not yet exist -os.system("mkdir -p /backup/wal_archive") -os.system("chown -R postgres:postgres /backup") - -# Render config files -for pg_file in glob.glob("/conf/*.conf"): - conf.jinja(pg_file, os.environ, os.path.join("/data", os.path.basename(pg_file))) - -# (Re)start postgresql locally for DB and user creation -os.system("sudo -u postgres pg_ctl start -D /data -o '-h \"''\" '") -while os.path.isfile("recovery.conf"): - pass -os.system("sudo -u postgres pg_ctl -D /data promote") -setup() -os.system("sudo -u postgres pg_ctl stop -m smart -w -D /data") - -out=open("/proc/1/fd/1", "w") -err=open("/proc/1/fd/2", "w") -# Run the cron deamon -subprocess.Popen(["crond", "-f"], stdout=out, stderr=err) -# Run postgresql service -os.system("sudo -u postgres postgres -D /data -h \*")
diff --git a/tests/build.yml b/tests/build.yml --- a/tests/build.yml +++ b/tests/build.yml @@ -65,13 +65,6 @@ services: args: VERSION: ${PINNED_MAILU_VERSION:-local} - postgresql: - image: ${DOCKER_ORG:-mailu}/postgresql:${PINNED_MAILU_VERSION:-local} - build: - context: ../optional/postgresql - args: - VERSION: ${PINNED_MAILU_VERSION:-local} - roundcube: image: ${DOCKER_ORG:-mailu}/${DOCKER_PREFIX:-}roundcube:${PINNED_MAILU_VERSION:-local} build:
[Setup utility] Cannot generate files when database flavors have been switched ## Before you open your issue - [x] Check if no issue or pull-request for this already exists. - [x] Check [documentation](https://mailu.io/master/) and [FAQ](https://mailu.io/master/faq.html). (Tip, use the search function on the documentation page) - [x] You understand `Mailu` is made by volunteers in their **free time** โ€” be conscise, civil and accept that delays can occur. - [x] The title of the issue should be short and simple. It should contain specific terms related to the actual issue. Be specific while writing the title. ## Environment & Versions ### Environment - [x] docker-compose - [ ] kubernetes - [x] docker swarm ### Versions All versions ## Description In the setup utility when you select a different database flavor and then switch back to SQLite, then you can not generate the files. The reason is that it still expects the fields to be filled of the alternative database flavor you previously selected. When you select an alternative database flavor, the fields (e.g. hostname, database name) are mandatory. These fields are still mandatory when you switch back to SQLlite as database flavor. As a workaround you can fill in mandatory fields and then switch back to SQLite again. Or you could refresh the page and do not switch from SQLite. The problem is in https://github.com/Mailu/Mailu/blob/master/setup/templates/steps/database.html . I didn't check yet how to resolve this. ## Replication Steps 1) Go to https://setup.mailu.io/master/ and click next. 2). Enter a value for main domain server and public hostname. 3). Select roundcube as webmail. 4). At the bottom switch to postgresql or mysql as database 5). Switch back to SQLite as database. 6). Click Setup mailu. Note that the button does not work. ## Expected behaviour The Setup Mailu button works after following about steps. [Setup utility] Cannot generate files when database flavors have been switched ## Before you open your issue - [x] Check if no issue or pull-request for this already exists. - [x] Check [documentation](https://mailu.io/master/) and [FAQ](https://mailu.io/master/faq.html). (Tip, use the search function on the documentation page) - [x] You understand `Mailu` is made by volunteers in their **free time** โ€” be conscise, civil and accept that delays can occur. - [x] The title of the issue should be short and simple. It should contain specific terms related to the actual issue. Be specific while writing the title. ## Environment & Versions ### Environment - [x] docker-compose - [ ] kubernetes - [x] docker swarm ### Versions All versions ## Description In the setup utility when you select a different database flavor and then switch back to SQLite, then you can not generate the files. The reason is that it still expects the fields to be filled of the alternative database flavor you previously selected. When you select an alternative database flavor, the fields (e.g. hostname, database name) are mandatory. These fields are still mandatory when you switch back to SQLlite as database flavor. As a workaround you can fill in mandatory fields and then switch back to SQLite again. Or you could refresh the page and do not switch from SQLite. The problem is in https://github.com/Mailu/Mailu/blob/master/setup/templates/steps/database.html . I didn't check yet how to resolve this. ## Replication Steps 1) Go to https://setup.mailu.io/master/ and click next. 2). Enter a value for main domain server and public hostname. 3). Select roundcube as webmail. 4). At the bottom switch to postgresql or mysql as database 5). Switch back to SQLite as database. 6). Click Setup mailu. Note that the button does not work. ## Expected behaviour The Setup Mailu button works after following about steps.
2021-12-01T16:10:25