jackyzy823 / fxa-selfhosting

Selfhosting your own Firefox Accounts (FxA)!
Mozilla Public License 2.0
94 stars 13 forks source link

Problem when sending email, does fxa smtp follow the protocol correctly #23

Closed Dataaja95 closed 5 months ago

Dataaja95 commented 5 months ago

hi I have defined the fxa configuration file as the mail sender type 3rd, the username, password and other server information are correct, the port I use is 587, but I get such an error message in the logs of my postfix server, it would seem that fxa does not follow the smtp protocol, or is it a programming error . server postfix/submission/smtpd[6987]: connect from xxxxxxxxx[xxxxxxx]\n2024-04-09T08:45:36.913314+03:00 server postfix/submission/smtpd[6987]: improper command pipelining after CONNECT from xxxxxxx[xxxxxxx]: \026\003\001\001u\001\000\001q\003\003H\373\v\205\200*\207\024\301\267\236LV\244\232\255i\224R\361Q\311\036J\v\033\257\3357\330-) ,m\260Rh^d\027\001W}\366)\320\032\252\247Vvg\251\254\226\v\004\337\353\326g8\254\277\000v\023\002\023\003\023\001\300/\300+\3000\300,\000\236\300'\000g\300(\n2024-04-09T08:45:36.926912+03:00 server postfix/submission/smtpd[6987]: lost connection after CONNECT from xxxxxxx[xxxxxx]\n2024-04-09T08:45:36.927369+03:00 server postfix/submission/smtpd[6987]: disconnect from xxxxxx[xxxxxx] commands=0/0",

jackyzy823 commented 5 months ago

Hello, i don't use 3rd sender.

So just a guess: Did you set smtp_secure to true , but your sender doesn't support at port 587 (ie it talks plain SMTP protocol , not over tls) ?

Dataaja95 commented 5 months ago

smtp_secure is true and the port is 587, does fxa accept directly contact the mail server or does it use postfix which is installed on the machine where fxa is installed which should i use if i don't use 3rd as send type.

jackyzy823 commented 5 months ago

If your machine has sending email permission( most cloud provider requires opening a support ticket to allow machine to send email outgoing) ,you could use "localrelay" type ( this type bundled a exim4 to send email for you)

If you just want to use fxa stack yourself , you could just use "localhelper" type.

Dataaja95 commented 5 months ago

So how does localhelper work, do I specify the port, hostname and others the data normally for the fxa configuration, what about localrelay, it installs exim as a docker container, how do I configure the data for it, what if I use starttls on my server, how do I then configure fxa @jackyzy823

Dataaja95 commented 5 months ago

localhelper seems to work, I get a notification about sending an email when creating a user account, but no email never figure out how to configure localhelper with the correct email server settings

jackyzy823 commented 5 months ago

localhelper seems to work, I get a notification about sending an email when creating a user account, but no email never figure out how to configure localhelper with the correct email server settings

Please refer to the output of the ./init.sh , it tells you how to get your verify code from localhelper.

You could 1) https://github.com/jackyzy823/fxa-selfhosting/blob/bdfa323fc33d6142af0904bdb4af63b61db012c8/init.sh#L181

2) https://github.com/jackyzy823/fxa-selfhosting/blob/bdfa323fc33d6142af0904bdb4af63b61db012c8/init.sh#L189-L192

jackyzy823 commented 5 months ago

the data normally for the fxa configuration, what about localrelay, it installs exim as a docker container, how do I configure the data for it, what if I use starttls on my server, how do I then configure fxa

I don't really understand what you mean. Please at least paste your config.

localrelay only requires that your machine have permission to use port 25 (not be banned by the cloud provider) to send email.

Dataaja95 commented 5 months ago

Thanks, I got the system working using localhelper, I'm closing this the problem

Dataaja95 commented 5 months ago

Now Firefox is connected to the server, but the account manager in Firefox's sync settings doesn't seem to work, when I open it, I get an error General application error

Something went wrong. Please try again later.

Is this normal operation and that user interface has just not been implemented. @jackyzy823

jackyzy823 commented 5 months ago

Please post your config, the screenshot of error and if possible the console output from devtool (F12) of browser.

Dataaja95 commented 5 months ago

config.txt

fxa configuration in the file konfig.txt, here is the information that the browser's developer console showed. While pressing f12

.reactEasyCrop_Container { position: absolute; top: 0; left: 0; right: 0; bottom: 0; overflow: hidden; user-select: none; touch-action: none; cursor: move; display: flex; justify-content: center; align-items: center; }

.reactEasyCrop_Image, .reactEasyCrop_Video { will-change: transform; / this improves performances and prevent painting issues on iOS Chrome / }

.reactEasyCrop_Contain { max-width: 100%; max-height: 100%; margin: auto; position: absolute; top: 0; bottom: 0; left: 0; right: 0; } .reactEasyCrop_Cover_Horizontal { width: 100%; height: auto; } .reactEasyCrop_Cover_Vertical { width: auto; height: 100%; }

.reactEasyCrop_CropArea { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); border: 1px solid rgba(255, 255, 255, 0.5); box-sizing: border-box; box-shadow: 0 0 0 9999em; color: rgba(0, 0, 0, 0.5); overflow: hidden; }

.reactEasyCrop_CropAreaRound { border-radius: 50%; }

.reactEasyCrop_CropAreaGrid::before { content: ' '; box-sizing: border-box; position: absolute; border: 1px solid rgba(255, 255, 255, 0.5); top: 0; bottom: 0; left: 33.33%; right: 33.33%; border-top: 0; border-bottom: 0; }

.reactEasyCrop_CropAreaGrid::after { content: ' '; box-sizing: border-box; position: absolute; border: 1px solid rgba(255, 255, 255, 0.5); top: 33.33%; bottom: 33.33%; left: 0; right: 0; border-left: 0; border-right: 0; } @jackyzy823

jackyzy823 commented 5 months ago

I mean error log / failed request from devtool console . ( Not these css code)

And v1.247.2 is quite old version Is there any reason that you choose this version?

Dataaja95 commented 5 months ago

How can I upgrade to the latest version by downloading the changes with the command git pull in the configuration file the same old version is displayed. There is NO reason for me to use this old version @jackyzy823

jackyzy823 commented 5 months ago

1) git pull to the latest version. 2) cp the latest version config.yml.sample to config.yml 3) edit config.yml to customize 4) execute ./init.sh

Dataaja95 commented 5 months ago

I updated to the latest version, now account management doesn't open, but keeps downloading endlessly, etc attached conf and a screenshot from the window, error report from the Firefox developer console below Screenshot 2024-04-11 at 10-29-25 Mozilla accounts

config.txt

No Sentry dsn provided main.c641f4a6.js:2:523890 Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://syncgraphql.domain.local/graphql. (Reason: CORS request did not succeed). Status code: (null). 2 networkError TypeError: NetworkError when attempting to fetch resource. main.c641f4a6.js:2:311024 networkError TypeError: NetworkError when attempting to fetch resource. main.c641f4a6.js:2:311024 (Glean.core.Pings.Maker) Storage for deletion-request empty. Ping will still be sent. main.c641f4a6.js:2:1180483 (Glean.core.Upload.PingUploadManager) Ping 6ee2d6f8-bd41-4084-8383-654532569fdb successfully sent 200. main.c641f4a6.js:2:1180483 Download the Apollo DevTools for a better development experience: https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/ main.c641f4a6.js:2:1122658

@jackyzy823

jackyzy823 commented 5 months ago

It looks like CORS issue?

Could you post the request header / response from the request "OPTIONS https://syncgraphql.domain.local/graphql" in "Network" section of devtool.

jackyzy823 commented 5 months ago

Also could you check

1) If fxa-graphql-api cotainer works normally via docker-compose ps fxa-graphql-api , the status should be "UP"

2) If your local connection to graphql-api server works normally , via `curl -i https://syncgraphql.domain.local/graphql" it should return http 415 with response like '{"statusCode":415,"message":"Request content type is not supported."}'

Dataaja95 commented 5 months ago

The problem was solved, it was a dns configuration error domain syncgraphql.domain.local was not added to the network dns server or the hosts file of the workstation, now everything works, thanks for the great project and keep up the good work @jackyzy823

Handrail9 commented 1 week ago

@jackyzy823 I wanted to pop in to let you know that it appears that if smtp_secure is true then the only port that it will log into is 465. Port 587 does not seem to work.

jackyzy823 commented 5 days ago

Hi @Handrail9 , fxa use nodemailer to send mail. according to the docs https://nodemailer.com/smtp/ , this might be the expected behavior.

port – is the port to connect to (defaults to 587 if is secure is false or 465 if true)

secure – if true the connection will use TLS when connecting to server. If false (the default) then TLS is used if server supports the STARTTLS extension. In most cases set this value to true if you are connecting to port 465. For port 587 or 25 keep it false