Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Mist sends invalid requests to SMTP mail server #1028

Open
davidrylance opened this issue Mar 17, 2022 · 6 comments
Open

Mist sends invalid requests to SMTP mail server #1028

davidrylance opened this issue Mar 17, 2022 · 6 comments

Comments

@davidrylance
Copy link

Dear Mist maintainers,

Thank you for Mist. It's great!

I host my own e-mail server (postfix) and I noticed that after I create an account for Mist and configure Mist to use it, the server is literally flooded by requests that generate a lot of warning logs.

I was thinking maybe there is something wrong the mail server hosted on public internet so I installed Postfix into a container on private LAN and configured it with no authentication to relay e-mails to public mail server and I see the same error logs.

Reproduce

Configure Mist e-mailing - in my case postfix on private LAN:

## Configure email settings.
MAILER_SETTINGS = {
    'mail.host': "192.168.1.25",
    'mail.port': "25",
    'mail.tls': False,
    'mail.starttls': False,
    'mail.username': "",
    'mail.password': "",
}
EMAIL_FROM = "[email protected]"

Or to use mailserver on public internet

MAILER_SETTINGS = {
    'mail.host': "some.mailserver.com",
    'mail.port': "587",
    'mail.tls': True,
    'mail.starttls': True,
    'mail.username': "[email protected]",
    'mail.password': "password",
}
EMAIL_FROM = "[email protected]"
  • Run Mist for the first time - no existing configuration
  • Add user: ./bin/adduser --admin '[email protected]' --password ...
  • Login via web
  • Add Cloud
  • Watch the mail server and you'll see this:
Mar 17 08:34:11 32bd932f8e98 postfix/smtpd[111]: connect from unknown[IP removed]
Mar 17 08:34:11 32bd932f8e98 postfix/smtpd[111]: warning: Illegal address syntax from unknown[IP removed] in RCPT command: <>
Mar 17 08:34:16 32bd932f8e98 postfix/smtpd[113]: connect from unknown[IP removed]
Mar 17 08:34:16 32bd932f8e98 postfix/smtpd[111]: lost connection after RSET from unknown[IP removed]
Mar 17 08:34:16 32bd932f8e98 postfix/smtpd[111]: disconnect from unknown[IP removed] ehlo=1 mail=1 rcpt=0/1 rset=1 commands=3/4
Mar 17 08:34:16 32bd932f8e98 postfix/smtpd[113]: warning: Illegal address syntax from unknown[IP removed] in RCPT command: <>
Mar 17 08:34:21 32bd932f8e98 postfix/smtpd[111]: connect from unknown[IP removed]
Mar 17 08:34:21 32bd932f8e98 postfix/smtpd[113]: lost connection after RSET from unknown[IP removed]
Mar 17 08:34:21 32bd932f8e98 postfix/smtpd[113]: disconnect from unknown[IP removed] ehlo=1 mail=1 rcpt=0/1 rset=1 commands=3/4
Mar 17 08:34:21 32bd932f8e98 postfix/smtpd[111]: warning: Illegal address syntax from unknown[IP removed] in RCPT command: <>
Mar 17 08:34:21 32bd932f8e98 postfix/smtpd[111]: lost connection after RSET from unknown[IP removed]
Mar 17 08:34:21 32bd932f8e98 postfix/smtpd[111]: disconnect from unknown[IP removed] ehlo=1 mail=1 rcpt=0/1 rset=1 commands=3/4
Mar 17 08:34:21 32bd932f8e98 postfix/smtpd[113]: connect from unknown[IP removed]
Mar 17 08:34:21 32bd932f8e98 postfix/smtpd[111]: connect from unknown[IP removed]
Mar 17 08:34:21 32bd932f8e98 postfix/smtpd[114]: connect from unknown[IP removed]
Mar 17 08:34:21 32bd932f8e98 postfix/smtpd[115]: connect from unknown[IP removed]
Mar 17 08:34:21 32bd932f8e98 postfix/smtpd[116]: connect from unknown[IP removed]
Mar 17 08:34:21 32bd932f8e98 postfix/smtpd[113]: warning: Illegal address syntax from unknown[IP removed] in RCPT command: <>
Mar 17 08:34:21 32bd932f8e98 postfix/smtpd[117]: connect from unknown[IP removed]
Mar 17 08:34:21 32bd932f8e98 postfix/smtpd[111]: warning: Illegal address syntax from unknown[IP removed] in RCPT command: <>
Mar 17 08:34:21 32bd932f8e98 postfix/smtpd[114]: warning: Illegal address syntax from unknown[IP removed] in RCPT command: <>
Mar 17 08:34:21 32bd932f8e98 postfix/smtpd[115]: warning: Illegal address syntax from unknown[IP removed] in RCPT command: <>
Mar 17 08:34:21 32bd932f8e98 postfix/smtpd[116]: warning: Illegal address syntax from unknown[IP removed] in RCPT command: <>
Mar 17 08:34:21 32bd932f8e98 postfix/smtpd[117]: warning: Illegal address syntax from unknown[IP removed] in RCPT command: <>
  • These logs starts after the first cloud is added.

Btw. e-mails work - I tested adding rule to mail myself when a VM is stopped / started and I get e-mails. It just something else Mist does that is wrong.

Thank you.

Kind regards,

David

@dimgal1
Copy link
Contributor

dimgal1 commented Mar 22, 2022

Hi @davidrylance we looked into this and it seems there are several issues leading to the problem.

  • By default Mist will query for some metrics the Victoria Metrics containers which are not included by default on docker-compose.yml.
  • Mist will try to send an email alert to a group (that should be configured in settings.py) that the metrics are inaccessible. If the email group is not configured an empty email address is passed likely causing the Illegal address syntax from unknown warning you posted.

To alleviate these issues:

  • Add a docker-compose.override.yml file on Mist installation folder with the following:
version: '2.0'

services:
  vminsert:
    image: victoriametrics/vminsert:v1.60.0-cluster
    command:
      - '--influxTrimTimestamp=1s'
      - '--storageNode=vmstorage:8400'
    ports:
      - 8480

  vmstorage:
    image: victoriametrics/vmstorage:v1.60.0-cluster
    command:
      - '--retentionPeriod=12'
      - '--storageDataPath=/var/lib/victoria-metrics-data'
    ports:
      - 8400
      - 8401
      - 8482
    volumes:
      - victoria-metrics:/var/lib/victoria-metrics-data

  vmselect:
    image: victoriametrics/vmselect:v1.60.0-cluster
    command:
      - '--search.latencyOffset=0s'
      - '--search.cacheTimestampOffset=15m'
      - '--storageNode=vmstorage:8401'
      - '--search.maxQueryLen=1GiB'
    ports:
      - 8481
  • Add the following to settings.py file and update the email addresses:
NOTIFICATION_EMAIL = {
    'all': "[email protected]",
    'dev': "[email protected]",
    'ops': "[email protected]",
    'sales': "[email protected]",
    'demo': "[email protected]",
    'support': "[email protected]",
}

Thanks for bringing this up to our attention. These issues will be fixed on our next release!

@davidrylance
Copy link
Author

Thank you very much @dimgal1 for resolving the problem.

Looking at variables in https://github.com/mistio/mist.api/blob/master/src/mist/api/config.py

Could you please tell if I also need to override other EMAIL_* variables in settings.py?

Like this:

MAILER_SETTINGS = {
    'mail.host': "192.168.1.25",
    'mail.port': "25",
    'mail.tls': False,
    'mail.starttls': False,
    'mail.username': "",
    'mail.password': "",
}
EMAIL_FROM = "[email protected]"
EMAIL_ALERTS = "[email protected]"
EMAIL_REPORTS = "[email protected]"
EMAIL_INFO = "[email protected]"
EMAIL_SALES = "[email protected]"
EMAIL_SUPPORT = "[email protected]"
EMAIL_NOTIFICATIONS = "[email protected]"
EMAIL_ALERTS_BCC = ""

NOTIFICATION_EMAIL = {
    'all': "[email protected]",
    'dev': "[email protected]",
    'ops': "[email protected]",
    'sales': "[email protected]",
    'demo': "[email protected]",
    'support': "[email protected]",
}

Thank you.

Kind regards,

David

@dimgal1
Copy link
Contributor

dimgal1 commented Mar 29, 2022

Yes, you can override these variables too. They are used as sender email accounts and depending on your mail server configuration they may not work with the default values

@davidrylance
Copy link
Author

Thank you @dimgal1 . I can confirm that NOTIFICATION_EMAIL in settings.py fixed the e-mail server being flooded by invalid requests.

Now I get a lot of e-mails about "Could not fetch old counter' and "Could not send metering data". docker-compose.override.yml was applied since I can see new containers after compose up:

Creating network "mist_io_default" with the default driver
Pulling vmstorage (victoriametrics/vmstorage:v1.60.0-cluster)...
v1.60.0-cluster: Pulling from victoriametrics/vmstorage
540db60ca938: Pull complete
ecb38ea512d4: Pull complete
26e0ed6f2d85: Pull complete
Digest: sha256:ee8dd29ce74e4790b9695de408e3b01f2582c31821b4bf7ce1167650a8953235
Status: Downloaded newer image for victoriametrics/vmstorage:v1.60.0-cluster
Pulling vmselect (victoriametrics/vmselect:v1.60.0-cluster)...
v1.60.0-cluster: Pulling from victoriametrics/vmselect
540db60ca938: Already exists
ecb38ea512d4: Already exists
7cc5443caa74: Pull complete
Digest: sha256:7977d31a1b272b875e165fc8ff06e2f9a54179bdc6c8edf876fe0456e8503eba
Status: Downloaded newer image for victoriametrics/vmselect:v1.60.0-cluster
Pulling vminsert (victoriametrics/vminsert:v1.60.0-cluster)...
v1.60.0-cluster: Pulling from victoriametrics/vminsert
540db60ca938: Already exists
ecb38ea512d4: Already exists
ce451e1025b8: Pull complete
Digest: sha256:faa5e9d6e891f34459498ca77b0e6fef888225502653b76877dd00ba4774027f
Status: Downloaded newer image for victoriametrics/vminsert:v1.60.0-cluster
Creating mist_io_wsproxy_1       ... done
Creating mist_io_vmselect_1      ... done
Creating mist_io_memcached_1     ... done
Creating mist_io_huproxy_1              ... done
Creating mist_io_mongodb_1       ... done
Creating mist_io_traefik_1       ... done
Creating mist_io_vmstorage_1            ... done
Creating mist_io_influxdb_1             ... done
Creating mist_io_rabbitmq_1      ... done
Creating mist_io_elasticsearch_1 ... done
Creating mist_io_mailmock_1      ... done
Creating mist_io_ui_1            ... done
Creating mist_io_vminsert_1             ... done
Creating mist_io_socat_1         ... done
Creating mist_io_landing_1       ... done
Creating mist_io_swagger_1              ... done
Creating mist_io_gocky_1                ... done
Creating mist_io_dramatiq_1             ... done
Creating mist_io_elasticsearch-manage_1 ... done
Creating mist_io_kibana_1               ... done
Creating mist_io_apply-migrations_1     ... done
Creating mist_io_logstash_1             ... done
Creating mist_io_scheduler_1            ... done
Creating mist_io_api-v2_1               ... done
Creating mist_io_api_1                  ... done
Creating mist_io_sockjs_1               ... done
Creating mist_io_nginx_1                ... done

But the containers don't seem to work properly since I get those error e-mails.

@davidrylance
Copy link
Author

docker-compose ps
  Name                                  Command               State                                                                  Ports
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
mist_io_api-v2_1                 /mist.api/bin/docker-init  ...   Up       8080/tcp
mist_io_api_1                    /mist.api/bin/docker-init  ...   Up       80/tcp
mist_io_apply-migrations_1       /mist.api/bin/docker-init  ...   Exit 0
mist_io_dramatiq_1               /mist.api/bin/docker-init  ...   Up
mist_io_elasticsearch-manage_1   ./scripts/add_templates.py       Exit 0
mist_io_elasticsearch_1          /docker-entrypoint.sh elas ...   Up       9200/tcp, 9300/tcp
mist_io_gocky_1                  /go/src/github.com/mistio/ ...   Up       0.0.0.0:9096->9096/tcp,:::9096->9096/tcp, 0.0.0.0:9097->9097/tcp,:::9097->9097/tcp
mist_io_huproxy_1                /app --listen 0.0.0.0:8086       Up       8086/tcp
mist_io_influxdb_1               /entrypoint.sh influxd           Up       0.0.0.0:8083->8083/tcp,:::8083->8083/tcp, 0.0.0.0:8086->8086/tcp,:::8086->8086/tcp
mist_io_kibana_1                 /docker-entrypoint.sh kibana     Up       5601/tcp
mist_io_landing_1                /entry.sh sh /entry.sh           Up       80/tcp, 8000/tcp
mist_io_logstash_1               /usr/local/bin/docker-entr ...   Up       5044/tcp, 9600/tcp
mist_io_mailmock_1               twistd -n localmail --smtp ...   Up       8025/tcp
mist_io_memcached_1              docker-entrypoint.sh memcached   Up       11211/tcp
mist_io_mongodb_1                docker-entrypoint.sh mongod      Up       27017/tcp
mist_io_nginx_1                  nginx -g daemon off;             Up       0.0.0.0:80->80/tcp,:::80->80/tcp
mist_io_rabbitmq_1               docker-entrypoint.sh rabbi ...   Up       15671/tcp, 15672/tcp, 15691/tcp, 15692/tcp, 25672/tcp, 4369/tcp, 5671/tcp, 5672/tcp
mist_io_scheduler_1              /mist.api/bin/docker-init  ...   Up
mist_io_socat_1                  socat TCP4-LISTEN:2375,for ...   Up       2375/tcp
mist_io_sockjs_1                 /mist.api/bin/docker-init  ...   Up       8081/tcp
mist_io_swagger_1                sh /usr/share/nginx/docker ...   Up       8080/tcp
mist_io_traefik_1                /traefik --accesslog --api ...   Up       0.0.0.0:8040->80/tcp,:::8040->80/tcp, 0.0.0.0:8041->8080/tcp,:::8041->8080/tcp
mist_io_ui_1                     /entry.sh sh /entry.sh           Up       80/tcp, 8000/tcp
mist_io_vminsert_1               /vminsert-prod --influxTri ...   Up       0.0.0.0:49156->8480/tcp,:::49156->8480/tcp
mist_io_vmselect_1               /vmselect-prod --search.la ...   Up       0.0.0.0:49153->8481/tcp,:::49153->8481/tcp
mist_io_vmstorage_1              /vmstorage-prod --retentio ...   Up       0.0.0.0:49157->8400/tcp,:::49157->8400/tcp, 0.0.0.0:49155->8401/tcp,:::49155->8401/tcp, 0.0.0.0:49154->8482/tcp,:::49154->8482/tcp
mist_io_wsproxy_1                python3 wsproxy.py               Up       8764/tcp

@cpsaltis
Copy link
Member

Hi @davidrylance, it will probably be easier to investigate this issue in real time. Would it be possible to arrange a quick call and look into it?

If not, we can stick to this ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants