wireapp / wire-server-deploy

Code to install/deploy wire-server (on kubernetes)
https://docs.wire.com
GNU Affero General Public License v3.0
94 stars 45 forks source link

error `Unexpected Error` register user in webapp #59

Closed zufardhiyaulhaq closed 5 years ago

zufardhiyaulhaq commented 5 years ago

What happened

error Unexpected Error when try to register user in bare-webapp.example.com

What you expected to happen

I can register and my email can receive email from wire-server

Step to reproduce

I create the step-by-step instalation in https://gist.github.com/zufardhiyaulhaq/ef9aa383292b34bf68198016c5fe1c49

Anything else we need to know?:

Environment

self troubleshooting

Based on wire-server-deploy documentation, I can open this following site

I can login into fakes3 (minio) with user dummykey and password dummysecret. But when I try to register account in webapp, I get error Unexpected Error.

image

I try to login with user dummykey and password dummysecret

image

I think the SMTP cannot send email properly. I am using gmail account with this configuration in values/wire-server/demo-values.yaml.

    emailSMS:
      general:
        emailSender: xxx@gmail.com
        smsSender: "insert-sms-sender-for-twilio" # change this if SMS support is desired
    smtp:
      host: smtp.gmail.com
      port: 587
      connType: tls

and plain user password in values/wire-server/demo-secrets.yaml

brig:
  secrets:
    smtpPassword: "plainpassword for user xxx@gmail.com"

wireapp pod

root@zu-master1:~/wire-server-deploy# kubectl -n demo get pod
NAME                                                              READY   STATUS      RESTARTS   AGE
brig-5dcd4848d8-78lsk                                             1/1     Running     0          104s
cannon-0                                                          1/1     Running     0          104s
cargohold-557b7d89b4-6t9m4                                        1/1     Running     0          104s
cassandra-ephemeral-0                                             1/1     Running     0          15m
cassandra-migrations-4nkvw                                        0/1     Completed   0          2m19s
demo-nginx-lb-ingress-nginx-ingress-controller-65f5c4cf8f-59s8c   1/1     Running     0          45s
demo-nginx-lb-ingress-nginx-ingress-default-backend-cfb85f46ddj   1/1     Running     0          45s
elasticsearch-ephemeral-c8f779df8-7rjvw                           1/1     Running     0          15m
elasticsearch-index-9hmw2                                         0/1     Completed   0          110s
fake-aws-dynamodb-6779d5f867-fgkb7                                2/2     Running     0          3m8s
fake-aws-s3-857f769967-zk7cw                                      1/1     Running     0          3m8s
fake-aws-sns-5cbfc979c7-wxggr                                     2/2     Running     0          3m8s
fake-aws-sqs-94c7dc958-c2ntq                                      2/2     Running     0          3m8s
galley-6ffd58ff7-692wz                                            1/1     Running     0          104s
gundeck-69f9cc8556-6qpxc                                          1/1     Running     0          104s
nginz-854b5574b4-24wmg                                            2/2     Running     0          104s
redis-ephemeral-646b8c65bf-9qfrl                                  1/1     Running     0          15m
webapp-8489fd85ff-f2vmc                                           1/1     Running     0          104s

brig logs

root@zu-master1:~/wire-server-deploy# kubectl -n demo logs brig-5dcd4848d8-78lsk
1:I,6:logger,1:=,14:cassandra.brig,50:Known hosts: [datacenter1:rack1:10.244.0.180:9042],
1:I,6:logger,1:=,14:cassandra.brig,62:New control connection: datacenter1:rack1:10.244.0.180:9042#11,
1:I,25:Listening on 0.0.0.0:8080,
fisx commented 5 years ago

I agree that this looks like an email issue.

You could set logLevel: Debug in the brig config, just to be sure you're not missing any hints.

Also, can you set things up with a demo-smtp pod, change the brig config to:

    smtp:
      host: demo-smtp
      port: 25
      connType: plain

I think you can configure demo-smtp as a proxy for gmail. The logs from there may give you more information about what's going on, or demo-smtp may do a better job at convincing gmail it's harmless than brig.

zufardhiyaulhaq commented 5 years ago

Hi @fisx

I have try to edit logLevel into Debug but still kubectl logs got nothing. image

zufardhiyaulhaq commented 5 years ago

Should I need additional configuration in smtp if I want to use demo-smtp as a proxy?

fisx commented 5 years ago

Should I need additional configuration in smtp if I want to use demo-smtp as a proxy?

You probably need to say which IPs you want to relay:

envVars:
  RELAY_NETWORKS: ":10.233.0.0/16"  # (or something)

All the details on this are paged out of my brain at the moment, but I suspect that demo-smtp will attempt to contact the smtp server of the recipient directly, and whether that works or not depends on the level of paranoia and brokenness of that particular smtp server. I know that gmail silently drops legitimate emails occasionally even though the docs say it doesn't. email is hard!

Let me know if that helps.

zufardhiyaulhaq commented 5 years ago

Hi @fisx

I following configuration from https://hub.docker.com/r/namshi/smtp/ and try to add environment in

envVars:
  GMAIL_USER: user@gmail.com
  GMAIL_PASSWORD: plainpassword

I get this error in smtp-demo

root@zu-master1:~/wire-server-deploy# kubectl logs demo-smtp-789b57764-4tnxq
+ sed -ri '
        s/^#?(dc_local_interfaces)=.*/\1='\''[0.0.0.0]:25 ; [::0]:25'\''/;
        s/^#?(dc_other_hostnames)=.*/\1='\'''\''/;
        s/^#?(dc_relay_nets)=.*/\1='\''10.244.1.180\/24'\''/;
        s/^#?(dc_eximconfig_configtype)=.*/\1='\''smarthost'\''/;
        s/^#?(dc_smarthost)=.*/\1='\''smtp.gmail.com::587'\''/;
        s/^#?(dc_relay_domains)=.*/\1='\'''\''/;
' /etc/exim4/update-exim4.conf.conf
+ update-exim4.conf -v
using non-split configuration scheme from /etc/exim4/exim4.conf.template
    1 LOG: MAIN
    1   exim 4.89 daemon started: pid=1, -q15m, listening for SMTP on port 25 (IPv6 and IPv4)
  282 LOG: host_lookup_failed MAIN
  282   no host name found for IP address 10.244.2.207
  282 LOG: smtp_connection MAIN
  282   SMTP connection from (brig-5b479cd78b-xlcv2) [10.244.2.207] lost
zufardhiyaulhaq commented 5 years ago

I think environment variables inside smtp-demo pod don't update because we run smtp-demo first. So I try to delete the pod and see the log again.

root@zu-master1:~/wire-server-deploy# kubectl delete pod demo-smtp-789b57764-4tnxq
pod "demo-smtp-789b57764-4tnxq" deleted
root@zu-master1:~/wire-server-deploy# kubectl get pod -o wide                     
NAME                                                              READY   STATUS        RESTARTS   AGE     IP             NODE            NOMINATED NODE   READINESS GATES
brig-5b479cd78b-xlcv2                                             1/1     Running       0          6m51s   10.244.2.207   10.202.202.90   <none>           <none>
cannon-0                                                          1/1     Running       0          6m51s   10.244.2.209   10.202.202.90   <none>           <none>
cargohold-557b7d89b4-xj4kh                                        1/1     Running       0          6m51s   10.244.0.194   10.202.202.70   <none>           <none>
cassandra-ephemeral-0                                             1/1     Running       0          10m     10.244.0.189   10.202.202.70   <none>           <none>
cassandra-migrations-8cc8n                                        0/1     Completed     0          7m25s   10.244.2.206   10.202.202.90   <none>           <none>
demo-nginx-lb-ingress-nginx-ingress-controller-65f5c4cf8f-xw9kp   1/1     Running       0          6m22s   10.244.1.182   10.202.202.80   <none>           <none>
demo-nginx-lb-ingress-nginx-ingress-default-backend-cfb85fh8qfb   1/1     Running       0          6m22s   10.244.2.210   10.202.202.90   <none>           <none>
demo-smtp-789b57764-4tnxq                                         1/1     Terminating   0          8m25s   10.244.1.180   10.202.202.80   <none>           <none>
demo-smtp-789b57764-cxwdf                                         1/1     Running       0          5s      10.244.1.183   10.202.202.80   <none>           <none>
root@zu-master1:~/wire-server-deploy# kubectl logs demo-smtp-789b57764-cxwdf
+ sed -ri '
        s/^#?(dc_local_interfaces)=.*/\1='\''[0.0.0.0]:25 ; [::0]:25'\''/;
        s/^#?(dc_other_hostnames)=.*/\1='\'''\''/;
        s/^#?(dc_relay_nets)=.*/\1='\''10.244.1.183\/24'\''/;
        s/^#?(dc_eximconfig_configtype)=.*/\1='\''smarthost'\''/;
        s/^#?(dc_smarthost)=.*/\1='\''smtp.gmail.com::587'\''/;
        s/^#?(dc_relay_domains)=.*/\1='\'''\''/;
' /etc/exim4/update-exim4.conf.conf
+ update-exim4.conf -v
using non-split configuration scheme from /etc/exim4/exim4.conf.template
    1 LOG: MAIN
    1   exim 4.89 daemon started: pid=1, -q15m, listening for SMTP on port 25 (IPv6 and IPv4)
root@zu-master1:~/wire-server-deploy# kubectl exec -it demo-smtp-789b57764-cxwdf -- cat /etc/exim4/update-exim4.conf.conf
# /etc/exim4/update-exim4.conf.conf
#
# Edit this file and /etc/mailname by hand and execute update-exim4.conf
# yourself or use 'dpkg-reconfigure exim4-config'
#
# Please note that this is _not_ a dpkg-conffile and that automatic changes
# to this file might happen. The code handling this will honor your local
# changes, so this is usually fine, but will break local schemes that mess
# around with multiple versions of the file.
#
# update-exim4.conf uses this file to determine variable values to generate
# exim configuration macros for the configuration file.
#
# Most settings found in here do have corresponding questions in the
# Debconf configuration, but not all of them.
#
# This is a Debian specific file

dc_eximconfig_configtype='smarthost'
dc_other_hostnames=''
dc_local_interfaces='[0.0.0.0]:25 ; [::0]:25'
dc_readhost=''
dc_relay_domains=''
dc_minimaldns='false'
dc_relay_nets='10.244.1.183/24'
dc_smarthost='smtp.gmail.com::587'
CFILEMODE='644'
dc_use_split_config='false'
dc_hide_mailname=''
dc_mailname_in_oh='true'
dc_localdelivery='mail_spool'

but still I can't register in web-app and still have UNEXPECTED ERROR.

zufardhiyaulhaq commented 5 years ago

I have try to update the relay network because kubernetes use 10.244.0.0/16

envVars:
  GMAIL_USER: user@gmail.com
  GMAIL_PASSWORD: plainpassword
  RELAY_NETWORKS: :10.244.0.0/16
root@zu-master1:~/wire-server-deploy# kubectl exec -it demo-smtp-8666946f65-6ch7k -- cat /etc/exim4/update-exim4.conf.conf                          

dc_eximconfig_configtype='smarthost'
dc_other_hostnames=''
dc_local_interfaces='[0.0.0.0]:25 ; [::0]:25'
dc_readhost=''
dc_relay_domains=''
dc_minimaldns='false'
dc_relay_nets='10.244.2.221/24:10.244.0.0/16'
dc_smarthost='smtp.gmail.com::587'
CFILEMODE='644'
dc_use_split_config='false'
dc_hide_mailname=''
dc_mailname_in_oh='true'
dc_localdelivery='mail_spool'

Still get UNEXPECTED ERROR

jschaul commented 5 years ago

Can you check whether the webapp is behaving correctly by checking its logs? Further, the configuration for the ingress or nginz might be incorrect, check the logs here as well. If you get an "Unexpected Error" when trying to log in, that is a problem that has nothing to do with email sending.

About email sending (first find out if that is your actual problem). There are 3 days you can configure email sending:

For any of these three cases, configure brig.config.emailSMS.general.emailSender. (This is the From: email address)

  1. use amazon's SES. Set brig.config.useSES to true and set brig.config.aws.sesEndpoint and brig.config.aws.sesQueue.
  2. use smtp with demo-smtp: The defaults from values/wire-server/demo-values.example.yaml should work. The downside here is that emails will be sent from a domain "example.com" and might land in your spam folder or not be delivered as considered illegitimate by the receiving mail provider (e.g. gmail).
  3. use smtp with your own smtp server. See https://github.com/wireapp/wire-server-deploy/blob/master/docs/configuration.md#smtp-server
  4. use the demo-smtp server as a relay to a real smtp server (as suggested earlier in this thread). This has no added benefit and is not recommended. Use options 1.-3. instead.
zufardhiyaulhaq commented 5 years ago

Fix this error already, The problem is in public and private key I generate, it's missing ==. the SMTP is working fine.

ghost commented 2 years ago

What happened

error Unexpected Error when try to register user in bare-webapp.example.com

What you expected to happen

I can register and my email can receive email from wire-server

Step to reproduce

I create the step-by-step instalation in https://gist.github.com/zufardhiyaulhaq/ef9aa383292b34bf68198016c5fe1c49

Anything else we need to know?:

Environment

  • Kubernetes baremetal v1.13.3 (the hard way, 3 etcd, 3 master, 3 worker)
  • Helm v.2.13.1
  • Self generated wildcard certificate (*.example.com)

self troubleshooting

Based on wire-server-deploy documentation, I can open this following site

  • webapp : bare-webapp.example.com
  • fakes3 : bare-s3.example.com
  • https: bare-https.example.com
  • ssl: bare-ssl.example.com

I can login into fakes3 (minio) with user dummykey and password dummysecret. But when I try to register account in webapp, I get error Unexpected Error.

image

I try to login with user dummykey and password dummysecret

image

I think the SMTP cannot send email properly. I am using gmail account with this configuration in values/wire-server/demo-values.yaml.

    emailSMS:
      general:
        emailSender: xxx@gmail.com
        smsSender: "insert-sms-sender-for-twilio" # change this if SMS support is desired
    smtp:
      host: smtp.gmail.com
      port: 587
      connType: tls

and plain user password in values/wire-server/demo-secrets.yaml

brig:
  secrets:
    smtpPassword: "plainpassword for user xxx@gmail.com"

wireapp pod

root@zu-master1:~/wire-server-deploy# kubectl -n demo get pod
NAME                                                              READY   STATUS      RESTARTS   AGE
brig-5dcd4848d8-78lsk                                             1/1     Running     0          104s
cannon-0                                                          1/1     Running     0          104s
cargohold-557b7d89b4-6t9m4                                        1/1     Running     0          104s
cassandra-ephemeral-0                                             1/1     Running     0          15m
cassandra-migrations-4nkvw                                        0/1     Completed   0          2m19s
demo-nginx-lb-ingress-nginx-ingress-controller-65f5c4cf8f-59s8c   1/1     Running     0          45s
demo-nginx-lb-ingress-nginx-ingress-default-backend-cfb85f46ddj   1/1     Running     0          45s
elasticsearch-ephemeral-c8f779df8-7rjvw                           1/1     Running     0          15m
elasticsearch-index-9hmw2                                         0/1     Completed   0          110s
fake-aws-dynamodb-6779d5f867-fgkb7                                2/2     Running     0          3m8s
fake-aws-s3-857f769967-zk7cw                                      1/1     Running     0          3m8s
fake-aws-sns-5cbfc979c7-wxggr                                     2/2     Running     0          3m8s
fake-aws-sqs-94c7dc958-c2ntq                                      2/2     Running     0          3m8s
galley-6ffd58ff7-692wz                                            1/1     Running     0          104s
gundeck-69f9cc8556-6qpxc                                          1/1     Running     0          104s
nginz-854b5574b4-24wmg                                            2/2     Running     0          104s
redis-ephemeral-646b8c65bf-9qfrl                                  1/1     Running     0          15m
webapp-8489fd85ff-f2vmc                                           1/1     Running     0          104s

brig logs

root@zu-master1:~/wire-server-deploy# kubectl -n demo logs brig-5dcd4848d8-78lsk
1:I,6:logger,1:=,14:cassandra.brig,50:Known hosts: [datacenter1:rack1:10.244.0.180:9042],
1:I,6:logger,1:=,14:cassandra.brig,62:New control connection: datacenter1:rack1:10.244.0.180:9042#11,
1:I,25:Listening on 0.0.0.0:8080,

Fix this error already, The problem is in public and private key I generate, it's missing ==. the SMTP is working fine.

how you fixed it please help!