blacktirion / email-oauth2-proxy-docker

Dockerized Version of simonrob/email-oauth2-proxy
37 stars 7 forks source link

No GUI and external auth not working #53

Open ClearlyDazed opened 1 day ago

ClearlyDazed commented 1 day ago

docker compose has external auth as default and receive this error message when trying to authorize:

2024-10-14 13:30:48,804: Not running interactively; unable to handle no-GUI external auth request

When server auth is chosen in dock compose, I will receive start of authorization process with external browser and get a authorization URL but when pasted into terminal for emailproxy nothing happens. It does not show option to paste here.

Running on headless server and external browser.

mabino commented 1 day ago

I left LOCAL_SERVER_AUTH true and then set a redirect_listen_address and port for the account's redirect_uri.

I was then able to pull the URL to authenticate out of the Docker logs for the container and paste it into a browser.

Unfortunately, while I see "received authentication response" in the logs, it is followed by "Authorisation result error for account" and "OAuth 2.0 authorisation response for account … is missing or does not matchredirect_uri".

The redirect_uri matches across pretty much everything, and non-containerized seem to work just fine, so I'm still at a loss.

ClearlyDazed commented 1 day ago

To complete the registration, I created a Python3.12 virtual environment and installed emailproxy. The resulting emailproxy.config file with the received tokens was then used in the docker install of emailproxy. I removed the emailproxy program from the python virtual environment. The docker install is forwarding my server linux system notifications to my personal Outlook email account again.

I used the following for initial emailproxy config for the python install: [Server setup] [SMTP-1587] server_address = smtp-mail.outlook.com server_port = 587 server_starttls = True local_starttls = False local_address = 127.0.0.1

[Account setup] [REDACTED@outlook.com] permission_url = https://login.microsoftonline.com/common/oauth2/v2.0/authorize token_url = https://login.microsoftonline.com/common/oauth2/v2.0/token oauth2_scope = https://outlook.office.com/SMTP.Send offline_access redirect_uri = http://localhost:8080 redirect_listen_address = http://0.0.0.0:80 client_id = REDACTED client_secret = REDACTED

[Advanced proxy configuration] [emailproxy] delete_account_token_on_password_error = False encrypt_client_secret_on_first_use = False use_login_password_as_client_credentials_secret = False allow_catch_all_accounts = False

I copied the resulting emailproxy.config with the received tokens but changed "local_address = emailproxy" for the docker install

The docker compose file: services: emailproxy: image: blacktirion/email-oauth2-proxy-docker # ghcr.io optional. this is published on both Docker Hub and Github Container Repository container_name: emailproxy restart: unless-stopped volumes:

mabino commented 15 hours ago

I tried something similar, but didn't think it was viable because when I copied the resulting emailproxy.config file over to the container, it removed the following lines.

token_salt = token_iterations = access_token = access_token_expiry = refresh_token =

I'd consider generating a working emailproxy.config and then using it with the Docker container a fair workaround, but it only retained the last_activity value and blanked the rest in my case. Strange.